npcObject.ts 893 B

123456789101112131415161718192021222324252627
  1. import bundleManager from "../../../manager/bundleManager";
  2. import { GAME_OBJECT_TYPE } from "../../utrl/gameEnum";
  3. import GameObject from "../gameObject";
  4. const { ccclass, property } = cc._decorator;
  5. /**未营救npc类 */
  6. @ccclass
  7. export default class NpcObject extends GameObject {
  8. /**npc id */
  9. @property
  10. view_id = 0;
  11. start() {
  12. this.type = GAME_OBJECT_TYPE.lock_npc;
  13. this.loadView();
  14. }
  15. loadView() {
  16. this.node.addComponent(cc.Sprite);
  17. bundleManager.setBundleFrame('UI', 'main/npc_lock/' + this.view_id, this.node);
  18. let node = new cc.Node;
  19. node.addComponent(cc.Sprite)
  20. bundleManager.setBundleFrame('UI', 'main/help', node);
  21. node.parent = this.node;
  22. node.y = 100;
  23. let t = 0.25;
  24. cc.tween(node).repeatForever(cc.tween(node).to(t, { scale: 1.2 }).to(t, { scale: 1 })).start();
  25. }
  26. }