本文整理匯總了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);
}
}