Step1.ts 786 B

1234567891011121314151617181920212223242526272829303132333435
  1. import EventListener from "../../../util/EventListener";
  2. import BaseEvent from "../../fight/evnet/base/BaseEvent";
  3. /**
  4. * 地图1 剧情1
  5. */
  6. const { ccclass, property } = cc._decorator;
  7. @ccclass
  8. export default class Step1 extends BaseEvent {
  9. @property({
  10. displayName: "小矮人",
  11. type: cc.Node,
  12. })
  13. npc_1: cc.Node = null;
  14. onLoad() {
  15. super.onLoad()
  16. EventListener.on("Step1", this.npcJump, this);
  17. this.npc_1.active = false;
  18. }
  19. npcJump() {
  20. this.npc_1.active = true;
  21. cc.tween(this.npc_1).sequence(
  22. cc.moveTo(0.5, cc.v2(this.npc_1.x + 300, this.npc_1.y)),
  23. cc.callFunc(() => {
  24. console.log("======小矮人跳出来======")
  25. })
  26. ).start();
  27. }
  28. }