示例#1
0
        public void Input_NormalMovement()
        {
            #region Left&Right
            if (InputMgr.IsPressing("Left"))
            {
                currentHorizontalSpeed = -currentSpeed * 2f;
            }
            else if (InputMgr.IsPressing("Right"))
            {
                currentHorizontalSpeed = currentSpeed * 2f;
            }
            else
            {
                currentHorizontalSpeed = 0;
            }
            #endregion

            #region Down&UP
            if (InputMgr.IsPressing("Up"))
            {
                currentVerticalSpeed = -currentSpeed;
            }
            else if (InputMgr.IsPressing("Down"))
            {
                currentVerticalSpeed = currentSpeed;
            }
            else
            {
                currentVerticalSpeed = 0;
            }
            #endregion

            Velocity = (Game.GlobalRight * currentHorizontalSpeed) + (Game.GlobalUp * currentVerticalSpeed);
        }
示例#2
0
 public override void OnShooting()
 {
     shootTime.Update(Game.window.deltaTime * additiveShootSpeed);
     if (InputMgr.IsPressing("MouseLeft"))
     {
         if (shootTime.EndTime())
         {
             Shoot((Up * 10) + (Right * -27));
             Shoot((Up * 10) + (Right * 27));
             shootTime.Reset();
         }
     }
 }
示例#3
0
 public bool OnMouseClick()
 {
     if (InputMgr.IsMouseOnArea(startPos, endPos))
     {
         Sprite.scale = new Vector2(1.25f);
         if (InputMgr.IsReleased("MouseLeft"))
         {
             return(true);
         }
     }
     else
     {
         Sprite.scale = new Vector2(1f);
     }
     return(false);
 }
示例#4
0
        public void Input_MouseMovement()
        {
            if (InputMgr.IsPressing("Left"))
            {
                Sprite.Rotation -= rotationSpeed * Game.window.deltaTime;
            }
            else if (InputMgr.IsPressing("Right"))
            {
                Sprite.Rotation += rotationSpeed * Game.window.deltaTime;
            }
            else
            {
                CheckRotation();
            }

            Position = Game.window.mousePosition;
        }
示例#5
0
        public void Input_MouseFollowing()
        {
            float slowVar = InputMgr.IsPressing("SlowMove") ? 0.5f : 1;

            #region Left&Right
            //if (Game.window.GetKey(KeyCode.A))
            if (InputMgr.IsPressed("Left"))
            {
                currentHorizontalSpeed = -currentSpeed * 2f;
            }
            else if (InputMgr.IsPressed("Right"))
            {
                currentHorizontalSpeed = currentSpeed * 2f;
            }
            else
            {
                currentHorizontalSpeed = 0;
            }
            #endregion

            #region Down&UP
            if (InputMgr.IsPressed("Up"))
            {
                currentVerticalSpeed = -currentSpeed;
            }
            else if (InputMgr.IsPressed("Down"))
            {
                currentVerticalSpeed = currentSpeed;
            }
            else
            {
                currentVerticalSpeed = 0;
            }
            #endregion

            LookAt(InputMgr.MousePosition);

            Velocity = ((Game.GlobalRight * currentHorizontalSpeed) + (Game.GlobalUp * currentVerticalSpeed)) * slowVar;
        }