JG0108_1.ts 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import BaseEvent from "../../fight/evnet/base/BaseEvent";
  2. /**
  3. * 地刺
  4. * 扩展地刺,碰撞后被弹出
  5. */
  6. const { ccclass, property } = cc._decorator;
  7. @ccclass
  8. export default class JG0108_1 extends BaseEvent {
  9. @property({
  10. displayName: '数值(怪物id)'
  11. })
  12. public monsterId = 1001;
  13. /**
  14. * 主角进入碰撞区域
  15. * @param tag 碰撞组件编号
  16. */
  17. public onBegin(tag: number) {
  18. let moveV2 = this.ff.mainSprite.moveV2
  19. this.ff.mainSprite.setPause(true)
  20. let des = 30;
  21. let x = -des*moveV2.x
  22. let y = -des*moveV2.y
  23. this.rmHP()
  24. cc.tween(this.ff.mainSprite.node).sequence(
  25. cc.moveBy(0.5,cc.v2(x,y)).easing(cc.easeBackOut()),
  26. cc.delayTime(0.2),
  27. cc.callFunc(()=>{
  28. this.ff.mainSprite.setPause(false)
  29. })
  30. ).start()
  31. }
  32. /**
  33. * 主角离开碰撞区域
  34. * @param tag 碰撞组件编号
  35. */
  36. public onEnd(tag: number) {
  37. }
  38. private rmHP() {
  39. let main = this.ff.main;
  40. let attrData = main.sManage.getMonsterData(this.monsterId);
  41. this.ff.mainSprite.bAtkjs(attrData);
  42. }
  43. }