| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- cc.Class({
- extends: require("BaseCharactor"),
- properties: {
- jumpAudio: {
- default: [],
- type: [cc.AudioClip],
- },
- perfect: {
- default: null,
- type: cc.Node,
- serializable: true,
- },
- indicateLeft: {
- default: null,
- type: cc.Node,
- serializable: true,
- },
- indicateRight: {
- default: null,
- type: cc.Node,
- serializable: true,
- },
- },
- init()
- {
- this._super();
- this.indicateLeftAvatar = this.indicateLeft.getChildByName('Avatar');
- this.indicateLeftDistance = this.indicateLeft.getChildByName('Distance');
- this.indicateRightAvatar = this.indicateRight.getChildByName('Avatar');
- this.indicateRightDistance = this.indicateRight.getChildByName('Distance');
- },
- countingJumpDistance(hurdrailStartPX,gameConfig){
- return hurdrailStartPX + gameConfig.handrailLength;
- },
- playJumpEffect()//over wirte
- {
- let audioClip = this.jumpAudio[this.pStatesSt.Combo];
- cc.audioEngine.playEffect(audioClip, 0, function () {});
- if(8==this.pStatesSt.Combo)
- {
- this.pStatesSt.Combo=0;
- if(!this.perfect.active)
- {
- this.perfect.active = true;
- }
- let anim = this.perfect.getComponent('cc.Animation');
- // 是动画组件cc.Animation组件实例来监听;
- anim.on("play", function()
- {
- // this.perfect.active = false;
- }.bind(this), this);
- anim.play();
- }
- this.pStatesSt.Combo++;
- },
- showIndicater(bLeft,distence)
- {
- if(bLeft)
- {
- this.indicateLeft.active = true;
- this.indicateRight.active = false;
- this.indicateLeftDistance.getComponent(cc.Label).string = distence;
- }
- else {
- this.indicateLeft.active = false;
- this.indicateRight.active = true;
- this.indicateRightDistance.getComponent(cc.Label).string = distence;
- }
- },
- hideIndicater()
- {
- this.indicateLeft.active = false;
- this.indicateRight.active = false;
- }
- });
|