本文整理汇总了TypeScript中model/player/Player.getDimensions函数的典型用法代码示例。如果您正苦于以下问题:TypeScript getDimensions函数的具体用法?TypeScript getDimensions怎么用?TypeScript getDimensions使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getDimensions函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: constructor
constructor(simulation : Simulation, owner : Player, position : Vector, velocity : Vector, lifetime : number) {
super(simulation, owner, 0 /* level */, lifetime, 0 /* damage */, -1 /* bounceCount */);
this.direction_ = owner.direction;
this.position_ = position;
this.velocity_ = velocity;
this.radius_ = owner.getDimensions().radius;
}
开发者ID:krslynx,项目名称:dotproduct,代码行数:8,代码来源:Decoy.ts
示例2: checkPlayerCollision_
protected checkPlayerCollision_(player : Player) : boolean {
if (!player.isAlive || this.owner_.isFriend(player) || !this.isActive_) {
return false;
}
if (player.getDimensions().boundingRect.contains(this.position_)) {
this.explode_(player);
return true;
}
return false;
}
开发者ID:krslynx,项目名称:dotproduct,代码行数:11,代码来源:Burst.ts
示例3: renderNearShipEnergyDisplay_
private renderNearShipEnergyDisplay_(context : CanvasRenderingContext2D, dimensions : any) {
if (!this.player_.isAlive) {
return;
}
let energy = this.player_.energy;
let playerDimensions = this.player_.getDimensions();
let percentEnergy = energy / this.player_.maxEnergy;
if (percentEnergy < 0.5) {
let x = Math.floor(playerDimensions.left - dimensions.left - 10);
let y = Math.floor(playerDimensions.top - dimensions.top);
context.save();
context.fillStyle = percentEnergy < 0.25 ? Palette.energyCriticalColor() : Palette.energyWarningColor();
context.font = Font.playerFont().toString();
context.textAlign = 'right';
context.textBaseline = 'bottom';
context.fillText(energy.toString(), x, y);
context.restore();
}
}
开发者ID:krslynx,项目名称:dotproduct,代码行数:22,代码来源:HudLayer.ts
示例4: checkPlayerCollision_
protected checkPlayerCollision_(player : Player) : boolean {
if (!player.isAlive || this.owner_.isFriend(player)) {
return false;
}
let distance = this.position_.subtract(player.getPosition()).magnitude();
if (player.getDimensions().boundingRect.contains(this.position_)) {
this.explode_(player);
return true;
} else if (!this.proxActivator_) {
if (distance <= this.proxRadius_) {
this.proxActivator_ = player;
this.lastDistanceToProxActivator_ = distance;
}
} else if (player == this.proxActivator_) {
if (distance > this.lastDistanceToProxActivator_) {
this.explode_(null);
return true;
}
this.lastDistanceToProxActivator_ = distance;
}
return false;
}
开发者ID:krslynx,项目名称:dotproduct,代码行数:23,代码来源:Bomb.ts
注:本文中的model/player/Player.getDimensions函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论