Step1.ts 911 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. }
  18. start() {
  19. if (this.npc_1) {
  20. this.npc_1.active = false;
  21. }
  22. }
  23. npcJump() {
  24. if (this.npc_1) {
  25. this.npc_1.active = true;
  26. cc.tween(this.npc_1).sequence(
  27. cc.moveTo(0.5, cc.v2(this.npc_1.x + 300, this.npc_1.y)),
  28. cc.callFunc(() => {
  29. console.log("======小矮人跳出来======")
  30. })
  31. ).start();
  32. }
  33. }
  34. }