本文整理汇总了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;未经允许,请勿转载。 |
请发表评论