当前位置: 首页>>代码示例>>C#>>正文


C# InputState.IsAimChanged方法代码示例

本文整理汇总了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);
                    }
                }
            }
        }
开发者ID:ProjPossibility,项目名称:USC-AccessibleKinect,代码行数:101,代码来源:GameplayScreen.cs


注:本文中的GameStateManagement.InputState.IsAimChanged方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。