import Armature from "./Armature"; import Role from "./Role"; const {ccclass, property} = cc._decorator; /**教练类 */ @ccclass export default class Coach extends Role { public property_damage:number = 5; public property_enduranceResumeSpeed:number = 5; public property_hp = 10000; public property_maxHp = 10000; public onLoad():void{ //初始化骨骼 this.armature =new Armature('armature/monster',this.node); //初始动画 this.armature.playAnimation(Role.AnimationName_Idle,0); super.onLoad(); } public mark:cc.Node; /** * 创建预备攻击提示标志 * @param direction 1为左,-1为右 * @param autoDestroy 自动销毁 * @param callback 回调函数 */ public createMark(direction:number,autoDestroy:boolean,callback:Function):void{ this.mark = new cc.Node(); this.mark.setScale(3); this.mark.setPosition(this.node.position.add(cc.v2(-250*direction,650))); this.mark.addComponent(cc.Sprite).spriteFrame = cc.loader.getRes('texture/mark',cc.SpriteFrame); window.gameMgr.background.addChild(this.mark); this.mark.runAction(cc.sequence(cc.shake(0.4,5,10),cc.callFunc(()=>{ if(autoDestroy){ this.mark.destroy(); } if(callback){ callback(); } },this))); cc.audioEngine.playEffect(cc.loader.getRes('audio/ding',cc.AudioClip),false); } }