TowerMgr.ts 803 B

123456789101112131415161718192021222324252627282930
  1. import { _decorator, instantiate, Prefab, Vec3 } from 'cc';
  2. import { ModulerBase } from './ModulerBase';
  3. import { GameMgr } from './GameMgr';
  4. import { MapMgr } from './MapMgr';
  5. import { resMgr } from '../../Frames/ResourcesMgr';
  6. const { ccclass, property } = _decorator;
  7. @ccclass('TowerMgr')
  8. export class TowerMgr extends ModulerBase {
  9. @property(Prefab)
  10. pre: Prefab = null;
  11. start() {
  12. //GameMgr.Instance.getModuler(MapMgr).test();
  13. //this.getModuler(MapMgr).test();
  14. }
  15. creatTower(pos: Vec3){
  16. const node = instantiate(this.pre);
  17. //const node = instantiate(resMgr.getPrefab("Tower"));
  18. node.setPosition(pos);
  19. node.parent = this.node;
  20. }
  21. protected clearSelf(): void {
  22. }
  23. update(deltaTime: number) {
  24. }
  25. }