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


C# Microsoft.IsKeyDown方法代码示例

本文整理汇总了C#中Microsoft.IsKeyDown方法的典型用法代码示例。如果您正苦于以下问题:C# Microsoft.IsKeyDown方法的具体用法?C# Microsoft.IsKeyDown怎么用?C# Microsoft.IsKeyDown使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft的用法示例。


在下文中一共展示了Microsoft.IsKeyDown方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Update

        public override void Update(GameTime gametime, Microsoft.Xna.Framework.Input.KeyboardState kbstate, Microsoft.Xna.Framework.Input.MouseState moustate)
        {
            this._Model.Update(gametime, kbstate, moustate);

            if(kbstate.IsKeyDown(Keys.A))
            {
                //this._Model.PlayClip(FLY_IDLE);
            }
            else if (kbstate.IsKeyDown(Keys.S))
            {
                this._Model.PlayClip(GROUND_IDLE, true);
            }
        }
开发者ID:vu159951,项目名称:d-r-a-g-o-n-b-a-l-l-c-h-a-o-s,代码行数:13,代码来源:My3DGameCharacter.cs

示例2: Control

 public override bool Control( GameEntity control, TimeSpan gameTime, Microsoft.Xna.Framework.Input.KeyboardState keyState )
 {
     if ( control == Owner && Owner.IsAlive && keyState.IsKeyDown( Owner.Keys.KeyShoot ) && ( lastShot == TimeSpan.Zero || ( gameTime - lastShot ).TotalMilliseconds > speed ) )
     {
         Owner.Shoot( gameTime );
         lastShot = gameTime;
     }
     return base.Control( control, gameTime, keyState );
 }
开发者ID:nitzanbueno,项目名称:TanksDropTwo,代码行数:9,代码来源:Minigun.cs

示例3: Update

 public void Update(InGame world, Microsoft.Xna.Framework.Input.KeyboardState ks)
 {
     //Checking for input.
     if (ks.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Left) && (ks.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Right)))
     {
     }
     else if ((ks.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Left)) && (PositionX > 0))
     {
         PositionX -= Speed;
         //The paddle can't go off the left side of the screen.
         if (PositionX < 0)
             PositionX = 0;
     }
     else if ((ks.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Right))&& (PositionX < Breakout.StageWidth - Width))
     {
         PositionX += Speed;
         //The paddle can't go beyond the right side of the stage.
         if (PositionX > Breakout.StageWidth - Width)
             //If we try, We are set next to the edge.
             PositionX = Breakout.StageWidth - Width;
     }
 }
开发者ID:CorruptData,项目名称:Breakout,代码行数:22,代码来源:Paddle.cs

示例4: HandleInput

        public void HandleInput(Microsoft.Xna.Framework.Input.KeyboardState keyboardState, Raquette _Raquette)
        {
            if (keyboardState.IsKeyDown(Keys.Space) && !_Launched && _StartTimer <= 0.0f)
            {
                _Launched = true;
            }

            if (keyboardState.IsKeyDown(Keys.Space) && _Stuck)
            {
                _Stuck = false;
                PositionY = _Raquette.Position.Y - 20;
                Speed = 0.5f;
            }

            //Si la balle est stuck tant que la balle reste dans le cadre on la fait bouger avec la raquette
            if (((keyboardState.IsKeyDown(Keys.Left) && (Position.X > _Viewport.X)) || (keyboardState.IsKeyDown(Keys.Right) && (Position.X + Texture.Width) < (_Viewport.Width + _Viewport.X) )) && _Stuck)
            {
                PositionX = _Raquette.PositionX + _DistanceFromRaquette;
            }
        }
开发者ID:Killermix,项目名称:PopCorn,代码行数:20,代码来源:Balle.cs

示例5: Update

 public override void Update(Microsoft.Xna.Framework.GameTime gameTime, Microsoft.Xna.Framework.Input.KeyboardState keyboard, Microsoft.Xna.Framework.Input.MouseState mouse)
 {
     if (findingNetwork)
     {
         if (introTime > 8.1f) introTime -= (float)gameTime.ElapsedGameTime.TotalSeconds * 4;
         networkTime -= (float)gameTime.ElapsedGameTime.TotalSeconds;
         if (networkTime < lastNetTime)
         {
             lastNetTime--;
             Network.FindServer();
             if (Network.IsConnected)
                 Login();
         }
         if (networkTime <= 0)
         {
             findingNetwork = false;
             lastNetTime = 10;
             netFailString = "No Network Found.";
         }
     }
     else
     {
         introTime += (float)gameTime.ElapsedGameTime.TotalSeconds;
         if (networkTime < 10)
             networkTime += (float)gameTime.ElapsedGameTime.TotalSeconds * 2;
     }
     if (introTime < 0 && introTime > -1)
         MobileFortressClient.Game.Exit();
     if (introTime > 8)
     {
         Manager.Update(gameTime,mouse);
         if (keyboard.IsKeyDown(Keys.Enter))
         {
             if (!loginMenuScroll)
                 loginButton.DoClick();
             else
                 loginConfirmButton.DoClick();
         }
     }
     else
     {
         if (keyboard.IsKeyDown(Keys.Escape) || keyboard.IsKeyDown(Keys.Enter))
             introTime = 8;
     }
     Viewport viewport = MobileFortressClient.Game.GraphicsDevice.Viewport;
     if (loginMenuScroll)
     {
         Color disabledColor = new Color(96, 64, 64);
         loginButton.canClick = false;
         loginButton.color = Color.Lerp(loginButton.color, disabledColor, 0.3f);
         optionsButton.canClick = false;
         optionsButton.color = Color.Lerp(optionsButton.color, disabledColor, 0.3f);
         exitButton.canClick = false;
         exitButton.color = Color.Lerp(exitButton.color, disabledColor, 0.3f);
         if (scrolledAmt < loginMenu.Height)
         {
             foreach (UIElement element in Manager.Elements)
             {
                 element.dimensions.Y -= 4;
             }
             scrolledAmt += 4;
         }
         loginDimensions.Y = viewport.Height - scrolledAmt;
     }
     else
     {
         loginButton.canClick = true;
         loginButton.color = Color.Lerp(loginButton.color, Color.LightGray, 0.3f);
         optionsButton.canClick = true;
         optionsButton.color = Color.Lerp(optionsButton.color, Color.LightGray, 0.3f);
         exitButton.canClick = true;
         exitButton.color = Color.Lerp(exitButton.color, Color.LightGray, 0.3f);
         if (scrolledAmt > 0)
         {
             foreach (UIElement element in Manager.Elements)
             {
                 element.dimensions.Y += 4;
             }
             scrolledAmt -= 4;
         }
         loginDimensions.Y = viewport.Height - scrolledAmt;
     }
 }
开发者ID:Aryn,项目名称:Mobile-Fortress,代码行数:83,代码来源:TitleScreen.cs

示例6: OnGameBaseKeyPress

		private void OnGameBaseKeyPress(Keys[] keys, Microsoft.Xna.Framework.Input.KeyboardState state)
		{
			if (state.IsKeyDown(Keys.F12))
			{
				IsGameRunning = false;
				Exit();
			}
			else if (keys.Length > 0)
			{
				OnKeyPress(keys, state);
			}
		}
开发者ID:mind0n,项目名称:hive,代码行数:12,代码来源:GameBase.cs

示例7: shouldSnapRotation

 internal static bool shouldSnapRotation(Microsoft.Xna.Framework.Input.KeyboardState kstate)
 {
     return !kstate.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.LeftControl);
 }
开发者ID:ade,项目名称:barrelbomber-leveleditor,代码行数:4,代码来源:AdesExtensions.cs

示例8: shouldSnapPosition

 internal static bool shouldSnapPosition(Microsoft.Xna.Framework.Input.KeyboardState kstate)
 {
     //This patch enables free positioning (ignore grid) when left control is held
     return (Constants.Instance.SnapToGrid && !kstate.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.LeftControl));
 }
开发者ID:ade,项目名称:barrelbomber-leveleditor,代码行数:5,代码来源:AdesExtensions.cs

示例9: HandleInput

        public void HandleInput(Microsoft.Xna.Framework.Input.KeyboardState keyboardState, ContentManager content)
        {
            if (keyboardState.IsKeyDown(Keys.Left) && Position.X > _Viewport.X)
            {
                PositionX -= Speed * ElapsedTime;
            }

            if (keyboardState.IsKeyDown(Keys.Right) && (Position.X + (Texture.Width * _SizeScale)) < _Viewport.Width + _Viewport.X)
            {
                PositionX += Speed * ElapsedTime;
            }

            BulletsTimer += ElapsedTime;

            if (_ListeBonus.ContainsKey(BonusType.Bullets) && keyboardState.IsKeyDown(Keys.A) && BulletsTimer >= 200.0f)
            {
                BulletsTimer = 0;

                Bullets BulletGauche = new Bullets(BulletsSide.Left);
                Bullets BulletDroite = new Bullets(BulletsSide.Right);

                _ListeBullets.Add(BulletGauche);
                _ListeBullets.Add(BulletDroite);

                BulletGauche.LoadContent(content, "Bullets");
                BulletDroite.LoadContent(content, "Bullets");

                BulletGauche.Initialize(_Viewport, this);
                BulletDroite.Initialize(_Viewport, this);
            }
        }
开发者ID:Killermix,项目名称:PopCorn,代码行数:31,代码来源:Raquette.cs


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