delayStop.ts 349 B

123456789101112131415
  1. import { GameLogic } from "./GameLogic";
  2. const {ccclass, property} = cc._decorator;
  3. @ccclass
  4. export default class DelayStop extends GameLogic {
  5. time = 10;
  6. call: Function;
  7. protected gameUpdate(dt: number): void {
  8. this.time -= dt;
  9. if(this.time <= 0 ){
  10. this.call && this.call();
  11. }
  12. }
  13. }