import BaseEvent from "../fight/evnet/base/BaseEvent"; /** * 地刺 * 扩展地刺,碰撞后被弹出 */ const { ccclass, property } = cc._decorator; @ccclass export default class JG0108_1 extends BaseEvent { @property({ displayName: '数值(怪物id)' }) public monsterId = 1001; /** * 主角进入碰撞区域 * @param tag 碰撞组件编号 */ public onBegin(tag: number) { let moveV2 = this.ff.mainSprite.moveV2 this.ff.mainSprite.setPause(true) let des = 30; let x = -des*moveV2.x let y = -des*moveV2.y this.rmHP() cc.tween(this.ff.mainSprite.node).sequence( cc.moveBy(0.5,cc.v2(x,y)).easing(cc.easeBackOut()), cc.delayTime(0.2), cc.callFunc(()=>{ this.ff.mainSprite.setPause(false) }) ).start() } /** * 主角离开碰撞区域 * @param tag 碰撞组件编号 */ public onEnd(tag: number) { } private rmHP() { let main = this.ff.main; let attrData = main.sManage.getMonsterData(this.monsterId); this.ff.mainSprite.bAtkjs(attrData); } }