當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript phaser.Timer類代碼示例

本文整理匯總了TypeScript中phaser.Timer的典型用法代碼示例。如果您正苦於以下問題:TypeScript Timer類的具體用法?TypeScript Timer怎麽用?TypeScript Timer使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Timer類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: kill

 kill(): Sprite {
   super.kill();
   this.shootingTimer.stop();
   this.producingTimer.stop();
   this.patch.params.isBusy = false;
   this.patch = null;
   return this;
 }
開發者ID:amatiasq,項目名稱:gamedev-course,代碼行數:8,代碼來源:plant.ts

示例2: init

  init(x: number, y: number, data: SunData) {
    this.params = data;
    this.reset(x, y);
    this.body.velocity.y = data.velocity || 0;
    this.inputEnabled = Boolean(data.value);

    if (this.inputEnabled) {
      this.input.pixelPerfectClick = true;
    }

    if (!data.eternal) {
      this.expirationTimer.start();
      this.expirationTimer.add(Math.between(2, 6) * Timer.SECOND, this.kill, this);
    }
  }
開發者ID:amatiasq,項目名稱:gamedev-course,代碼行數:15,代碼來源:sun.ts

示例3: init

  init(x: number, y: number, data: PlantData, patch: Sprite): Plant {
    this.params = data;
    this.patch = patch;
    this.reset(x, y, data.health);
    this.loadTexture(data.asset);
    this.shootAnimation = null;

    if (data.shoot) {
      this.shootingTimer.start();
      this.scheduleShooting();

      if (data.shoot.animation) {
        this.shootAnimation = data.asset + 'Anim';
        this.animations.add(this.shootAnimation, data.shoot.animation, 6, false);
      }
    }

    if (data.sunProduction) {
      this.producingTimer.start();
      this.scheduleProduction();
    }

    return this;
  }
開發者ID:amatiasq,項目名稱:gamedev-course,代碼行數:24,代碼來源:plant.ts

示例4: create

  create() {
    this.background = this.add.sprite(0, 0, 'background');
    this.hitSound = this.add.audio('hit');

    this.createLandPatches();

    this.plants = this.add.existing(new Pool<Plant>(this.game, () => new Plant(this)));
    this.zombies = this.add.existing(new Pool<Zombie>(this.game, () => new Zombie(this)));
    this.bullets = this.add.existing(new Pool<Bullet>(this.game, () => new Bullet(this)));
    this.suns = this.add.existing(new Pool<Sun>(this.game, () => new Sun(this)));

    this.createGui();

    this.sunGenerationTimer = this.game.time.create(false);
    this.sunGenerationTimer.start();
    this.scheduleGeneration();

    this.loadLevel();
  }
開發者ID:amatiasq,項目名稱:gamedev-course,代碼行數:19,代碼來源:game-state.ts

示例5: scheduleProduction

 private scheduleProduction() {
   this.produceSun();
   this.producingTimer.add(Timer.SECOND * this.params.sunProduction.interval, this.produceSun, this);
 }
開發者ID:amatiasq,項目名稱:gamedev-course,代碼行數:4,代碼來源:plant.ts

示例6: scheduleShooting

 private scheduleShooting() {
   this.shoot();
   this.shootingTimer.add(Timer.SECOND * this.params.shoot.interval, this.scheduleShooting, this);
 }
開發者ID:amatiasq,項目名稱:gamedev-course,代碼行數:4,代碼來源:plant.ts

示例7: kill

 kill(): Sun {
   super.kill();
   this.expirationTimer.stop();
   return this;
 }
開發者ID:amatiasq,項目名稱:gamedev-course,代碼行數:5,代碼來源:sun.ts

示例8: scheduleGeneration

 private scheduleGeneration() {
   this.sunGenerationTimer.add(Timer.SECOND * SUN_FREQUENCY, () => {
     this.generateRandomSun();
     this.scheduleGeneration();
   });
 }
開發者ID:amatiasq,項目名稱:gamedev-course,代碼行數:6,代碼來源:game-state.ts


注:本文中的phaser.Timer類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。