| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- cc.Class({
- extends: cc.Component,
- properties: {
- perfect: {
- default: null,
- type: cc.Node,
- serializable: true,
- },
- combo: {
- default: null,
- type: cc.Node,
- serializable: true,
- },
- x: {
- default: null,
- type: cc.Node,
- serializable: true,
- },
- num: {
- default: null,
- type: cc.Node,
- serializable: true,
- },
- hitAudio: {
- default: null,
- type: cc.AudioClip,
- serializable: true,
- },
- perfectAudio: {
- default: null,
- type: cc.AudioClip,
- serializable: true,
- },
- counting:0,
- },
- onLoad()
- {
- this.centerPosition = this.node.position;
- this.tween = cc.tween;
- },
- triggleCombo()
- {
- this.node.stopAllActions();
- this.node.position = this.centerPosition;
- this.node.opacity = 255;
- this.node.scale = 1;
- this.unschedule(this.unTriggleCombo);
- this.scheduleOnce(this.unTriggleCombo,2);
- if(this.counting == 10)
- {
- this.counting = 0;
- this.combo.active = false;
- this.x.active = false;
- this.num.active = false;
- this.perfect.active = true;
- cc.audioEngine.play(this.perfectAudio, false, 1);
- this.tween(this.node)
- .parallel(
- this.tween().to(1, { opacity: 0 }),
- this.tween().by(1, { scale: 1.2 }),
- this.tween().by(1, { position: cc.v2(0, 100) })
- )
- .start();
- return;
- }
- this.combo.active = true;
- this.x.active = true;
- this.num.active = true;
- this.perfect.active = false;
- this.counting++;
- this.num.getComponent(cc.Label).string = this.counting.toString();
- cc.audioEngine.play(this.hitAudio, false, 1);
- this.tween(this.node)
- .by(0.1, { position: cc.v2(0, 100) })
- .parallel(
- this.tween().to(1, { opacity: 0 }),
- this.tween().by(1, { position: cc.v2(0, 100) })
- )
- .start()
- },
- unTriggleCombo()
- {
- this.counting = 0;
- this.combo.active = false;
- this.x.active = false;
- this.num.active = false;
- this.perfect.active = false;
- },
- });
|