本文整理汇总了C#中GameEntity.getTargetType方法的典型用法代码示例。如果您正苦于以下问题:C# GameEntity.getTargetType方法的具体用法?C# GameEntity.getTargetType怎么用?C# GameEntity.getTargetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameEntity
的用法示例。
在下文中一共展示了GameEntity.getTargetType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Use
public void Use(Seizonsha game, GameEntity entity)
{
// entity is whatever is using this
// if (entity.isFrozen())
// {
// return;
// }
recharged = 0;
// entity.Freeze(recharge_time);
int damageType = Static.DAMAGE_TYPE_NO_DAMAGE;
if (entity.getTargetType() == Static.TARGET_TYPE_FRIENDLY){
damageType = Static.DAMAGE_TYPE_FRIENDLY;
}
if (entity.getTargetType() == Static.TARGET_TYPE_ENEMY){
damageType = Static.DAMAGE_TYPE_ENEMY;
}
Rectangle slashBounds = new Rectangle( entity.getCenterX(),
entity.getCenterY(),
Static.PLAYER_WIDTH/2,
Static.PLAYER_HEIGHT/2);
//Rectangle bulletBounds = new Rectangle(
game.Spawn(new Bullet(game, game.getTestSprite(slashBounds, Color.Red), slashBounds, damage, damageType, 1, bulletSpeed, entity.alexDirection));
// game sprite bounds amount dmgAmount dmgType duration bulletSpeed
}
示例2: Use
public void Use(Seizonsha game, GameEntity entity)
{
if (entity.isFrozen())
{
return;
}
recharged = 0;
entity.Freeze(recharge_time);
int damageType = Static.DAMAGE_TYPE_NO_DAMAGE;
if (entity.getTargetType() == Static.TARGET_TYPE_FRIENDLY){
damageType = Static.DAMAGE_TYPE_FRIENDLY;
}
if (entity.getTargetType() == Static.TARGET_TYPE_ENEMY){
damageType = Static.DAMAGE_TYPE_ENEMY;
}
Rectangle slashBounds = new Rectangle(entity.getCenterX()+(int)(entity.width/2 * Math.Cos(entity.getDirectionAngle())), entity.getCenterY() - (int)(entity.height/2 * Math.Sin(entity.getDirectionAngle())), Static.PLAYER_WIDTH/2, Static.PLAYER_HEIGHT/2);
game.Spawn(new SwordSlash(game, game.getTestSprite(slashBounds, Color.Green), slashBounds, damage, damageType, 10));
}