MonsterMgr.ts 446 B

1234567891011121314151617181920
  1. import { _decorator, Component, instantiate, Node, Prefab } from 'cc';
  2. const { ccclass, property } = _decorator;
  3. @ccclass('MonsterMgr')
  4. export class MonsterMgr extends Component {
  5. @property(Prefab)
  6. monsterPre: Prefab = null;
  7. start() {
  8. this.schedule(()=>{
  9. const monster = instantiate(this.monsterPre);
  10. monster.parent = this.node;
  11. }, 2)
  12. }
  13. update(deltaTime: number) {
  14. }
  15. }