本文整理汇总了C#中GameStateManagement.InputState.IsAimChanged方法的典型用法代码示例。如果您正苦于以下问题:C# InputState.IsAimChanged方法的具体用法?C# InputState.IsAimChanged怎么用?C# InputState.IsAimChanged使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameStateManagement.InputState
的用法示例。
在下文中一共展示了InputState.IsAimChanged方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleInput
//.........这里部分代码省略.........
{
double missileAngle = ((player1.shotAngle /** (Math.PI / 180)*/));
Console.WriteLine("The missile angle is: "+missileAngle);
Projectile missile;
if (missileAngle < 0)
{
missile = new Projectile(ScreenManager.Game,
new Vector2(player1.cannonLocation.X - (float)(Math.Cos(missileAngle) * player1.cannonTexture.Height), (float)(Math.Sin(missileAngle) * player1.cannonTexture.Height) + player1.cannonLocation.Y - player1.texture.Height), new Vector2(-player1.force, player1.force));
}
else
{
missile = new Projectile(ScreenManager.Game,
new Vector2(player1.cannonLocation.X + (float)(Math.Cos(missileAngle) * player1.cannonTexture.Height), (float)(Math.Sin(missileAngle) * player1.cannonTexture.Height) + player1.cannonLocation.Y - player1.texture.Height), new Vector2(player1.force, player1.force));
}
player1.fireMissile(missile);
ScreenManager.Game.Components.Add(missile);
}
else
{
double missileAngle = ((player2.shotAngle /** (Math.PI / 180)*/));
Console.WriteLine("The missile angle is: " + missileAngle);
Projectile missile;
if (missileAngle < 0)
{
missile = new Projectile(ScreenManager.Game,
new Vector2(player2.cannonLocation.X - (float)(Math.Cos(missileAngle) * player2.cannonTexture.Height), (float)(Math.Sin(missileAngle) * player2.cannonTexture.Height) + player2.cannonLocation.Y - player2.texture.Height), new Vector2(player2.force, player2.force));
}
else
{
missile = new Projectile(ScreenManager.Game,
new Vector2(player2.cannonLocation.X + (float)(Math.Cos(missileAngle) * player2.cannonTexture.Height), (float)(Math.Sin(missileAngle) * player2.cannonTexture.Height) + player2.cannonLocation.Y - player2.texture.Height), new Vector2(-player2.force, player2.force));
}
player2.fireMissile(missile);
ScreenManager.Game.Components.Add(missile);
}
}
if (input.IsTankMovingLeft(ControllingPlayer))
{
if (isPlayer1Turn)
{
player1.moveTank("Left");
}
else
{
player2.moveTank("Left");
}
}
if (input.IsTankMovingRight(ControllingPlayer))
{
if (isPlayer1Turn)
{
player1.moveTank("Right");
}
else
{
player2.moveTank("Right");
}
}
if (input.IsAimUp(ControllingPlayer))
{
if (isPlayer1Turn)
{
player1.changeAim("Up");
}
else
{
player2.changeAim("Up");
}
}
if (input.IsAimDown(ControllingPlayer))
{
if (isPlayer1Turn)
{
player1.changeAim("Down");
}
else
{
player2.changeAim("Down");
}
}
if (input.IsAimChanged(ControllingPlayer) != -1)
{
if (isPlayer1Turn)
{
player1.shotAngle = input.IsAimChanged(ControllingPlayer);
}
else
{
player2.shotAngle = input.IsAimChanged(ControllingPlayer);
}
}
}
}