本文整理汇总了C#中GameState.getTroops方法的典型用法代码示例。如果您正苦于以下问题:C# GameState.getTroops方法的具体用法?C# GameState.getTroops怎么用?C# GameState.getTroops使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameState
的用法示例。
在下文中一共展示了GameState.getTroops方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawTroop
public void DrawTroop(SpriteBatch spriteBatch, GameState gameState)
{
base.DrawFactory(spriteBatch, gameState);
List<Troop> troops = gameState.getTroops();
for(int i = 0; i < troops.Count; i++)
{
if (troops[i].Fighting)
{
Vector2 troopOrigin = new Vector2(battle.Width * 0.5f, battle.Height * 0.5f);
spriteBatch.Draw(battle, troops[i].CurrentPos, null, Color.White, troops[i].Rotation, troopOrigin, 1.0f, SpriteEffects.None, 1.0f);
}
else if (troops[i].ObjectType == 1)
{
Vector2 troopOrigin = new Vector2(blue_tank.Width * 0.5f, blue_tank.Height * 0.5f);
spriteBatch.Draw(blue_tank, troops[i].CurrentPos, null, Color.White, troops[i].Rotation, troopOrigin, 1.0f, SpriteEffects.None, 1.0f);
}
else
{
Vector2 troopOrigin = new Vector2(red_tank.Width * 0.5f, red_tank.Height * 0.5f);
spriteBatch.Draw(red_tank, troops[i].CurrentPos, null, Color.White, troops[i].Rotation, troopOrigin, 1.0f, SpriteEffects.None, 1.0f);
}
spriteBatch.DrawString(font, troops[i].Elements.ToString(), troops[i].CurrentPos, Color.Yellow);
}
}