Ejemplo n.º 1
0
        private void temporaryControls()
        {
            float m = 0.025f;

            if (GameKeyState.IsKeyDown(Keys.W))
            {
                BananaGame.GameCamera.Position += Vector3.Forward * m;
            }

            if (GameKeyState.IsKeyDown(Keys.S))
            {
                BananaGame.GameCamera.Position += Vector3.Backward * m;
            }

            if (GameKeyState.IsKeyDown(Keys.A))
            {
                BananaGame.GameCamera.Position += Vector3.Left * m;
            }

            if (GameKeyState.IsKeyDown(Keys.D))
            {
                BananaGame.GameCamera.Position += Vector3.Right * m;
            }

            if (GameKeyState.IsKeyDown(Keys.LeftShift))
            {
                BananaGame.GameCamera.Position += Vector3.Down * m;
            }

            if (GameKeyState.IsKeyDown(Keys.Space))
            {
                BananaGame.GameCamera.Position += Vector3.Up * m;
            }
        }
Ejemplo n.º 2
0
        public override void Update()
        {
            Vector2 moveVector = Vector2.Zero;

            if (GameKeyState.IsKeyDown(ForwardKey))
            {
                moveVector += new Vector2(0, 1);
                if (SelectedPlayer.Collection.CurrentAnimationName != "up") //move to player
                {
                    SelectedPlayer.Collection.PlayAnimation("up");
                }
            }
            else if (GameKeyState.IsKeyDown(BackKey))
            {
                moveVector += new Vector2(0, -1);
                if (SelectedPlayer.Collection.CurrentAnimationName != "down")
                {
                    SelectedPlayer.Collection.PlayAnimation("down");
                }
            }
            else if (GameKeyState.IsKeyDown(LeftKey))
            {
                moveVector += new Vector2(-1, 0);
                if (SelectedPlayer.Collection.CurrentAnimationName != "left")
                {
                    SelectedPlayer.Collection.PlayAnimation("left");
                }
            }
            else if (GameKeyState.IsKeyDown(RightKey))
            {
                moveVector += new Vector2(1, 0);
                if (SelectedPlayer.Collection.CurrentAnimationName != "right")
                {
                    SelectedPlayer.Collection.PlayAnimation("right");
                }
            }
            else
            {
                if (SelectedPlayer.Collection.CurrentAnimationName == "up")
                {
                    SelectedPlayer.Collection.PlayAnimation("standUp");
                }
                else if (SelectedPlayer.Collection.CurrentAnimationName == "down")
                {
                    SelectedPlayer.Collection.PlayAnimation("standDown");
                }
                else if (SelectedPlayer.Collection.CurrentAnimationName == "left")
                {
                    SelectedPlayer.Collection.PlayAnimation("standLeft");
                }
                else if (SelectedPlayer.Collection.CurrentAnimationName == "right")
                {
                    SelectedPlayer.Collection.PlayAnimation("standRight");
                }
            }

            /// Test move for movePlayerToHere()
            /// Hold the Z button to test
            if (GameKeyState.IsKeyPressed(Keys.Z))
            {
                movePlayerToHere();
            }

            //if (GameKeyState.IsKeyDown(JumpKey))
            //{
            //    moveVector += Vector3.Up;
            //}

            //if (GameKeyState.IsKeyPressed(Keys.F))
            //{
            //    Diamond dia = new Diamond(SelectedPlayer.Scanner.NearAimPoint);
            //    dia.Direction = FenceGame.GameCamera.LookVector;
            //    dia.Load();
            //    ProjectileManager.Add(dia);
            //}

            //if (GameKeyState.IsKeyPressed(Keys.J))
            //{
            //    SelectedPlayer.PhysicsModel.IsJumping = true;
            //}

            //if (GameKeyState.IsKeyDown(DecendKey))
            //{
            //    moveVector += Vector3.Down;
            //}

            //if (GameKeyState.IsKeyPressed(Keys.Q))
            //{
            //    SelectedPlayer.TestTool.SwitchItems();
            //}

            //if (GameMouseState.IsLeftButtonClicked())
            //{
            //    SelectedPlayer.TestTool.Use();
            //}

            //if (GameMouseState.IsMiddleButtonClicked())
            //{
            //    SelectedPlayer.TestTool.AltUse();
            //}

            //if (GameKeyState.IsKeyPressed(Keys.NumPad9))
            //{
            //    SelectedPlayer.TestTool.BuildTool.RotateRight();
            //}

            if (moveVector != Vector2.Zero)
            {
                //Matrix rotationMatrix = Matrix.CreateRotationY(FenceGame.GameCamera.LeftRightRotation);
                //Vector3 rotatedVector = Vector3.Transform(moveVector, rotationMatrix);
                SelectedPlayer.AddAcceleration(moveVector);
            }
        }