MainScene.ts 556 B

123456789101112131415161718192021222324
  1. import { _decorator, Component, director, instantiate, Node, Prefab, resources } from 'cc';
  2. import { CountDown } from './CountDown';
  3. const { ccclass, property } = _decorator;
  4. @ccclass('MainScene')
  5. export class MainScene extends Component {
  6. @property(Prefab)
  7. countDown:Prefab;
  8. start() {
  9. let countDown = instantiate(this.countDown);
  10. console.log(countDown.active)
  11. director.getScene().addChild(countDown);
  12. countDown.setPosition(100,110);
  13. }
  14. update(deltaTime: number) {
  15. }
  16. }