public FateAscensionRoguelike()
     : base()
 {
     graphics = new GraphicsDeviceManager(this);
     Content.RootDirectory = "Content";
     _inputState = new InputState();
 }
示例#2
0
        // Move the camera's position based on input
        public void HandleInput(InputState inputState, PlayerIndex? controllingPlayer)
        {
            Vector2 cameraMovement = Vector2.Zero;

            if (inputState.IsScrollLeft(controllingPlayer))
            {
                cameraMovement.X = -1;
            }
            else if (inputState.IsScrollRight(controllingPlayer))
            {
                cameraMovement.X = 1;
            }
            if (inputState.IsScrollUp(controllingPlayer))
            {
                cameraMovement.Y = -1;
            }
            else if (inputState.IsScrollDown(controllingPlayer))
            {
                cameraMovement.Y = 1;
            }
            if (inputState.IsZoomIn(controllingPlayer))
            {
                AdjustZoom(0.25f);
            }
            else if (inputState.IsZoomOut(controllingPlayer))
            {
                AdjustZoom(-0.25f);
            }

            // to match the thumbstick behavior, we need to normalize non-zero vectors in case the user
            // is pressing a diagonal direction.
            if (cameraMovement != Vector2.Zero)
            {
                cameraMovement.Normalize();
            }

            // scale our movement to move 25 pixels per second
            cameraMovement *= 25f;

            // move the camera
            MoveCamera(cameraMovement, true);
        }
示例#3
0
 public bool HandleInput(InputState inputState, IMap map)
 {
     if (inputState.IsLeft(PlayerIndex.One))
     {
         int tempX = X - 1;
         if (map.IsWalkable(tempX, Y))
         {
             // Check to see if there is an enemy at the location
             // that the player is attempting to move into
             var enemy = Global.CombatManager.EnemyAt(tempX, Y);
             if (enemy == null)
             {
                 // When there is not an enemy, move as normal
                 X = tempX;
             }
             else
             {
                 // When there is an enemy in the cell, make an
                 // attack against them by using the CombatManager
                 Global.CombatManager.Attack(this, enemy);
             }
             return true;
         }
     }
     else if (inputState.IsRight(PlayerIndex.One))
     {
         int tempX = X + 1;
         if (map.IsWalkable(tempX, Y))
         {
             // Check to see if there is an enemy at the location
             // that the player is attempting to move into
             var enemy = Global.CombatManager.EnemyAt(tempX, Y);
             if (enemy == null)
             {
                 // When there is not an enemy, move as normal
                 X = tempX;
             }
             else
             {
                 // When there is an enemy in the cell, make an
                 // attack against them by using the CombatManager
                 Global.CombatManager.Attack(this, enemy);
             }
             return true;
         }
     }
     else if (inputState.IsUp(PlayerIndex.One))
     {
         int tempY = Y - 1;
         if (map.IsWalkable(X, tempY))
         {
             // Check to see if there is an enemy at the location
             // that the player is attempting to move into
             var enemy = Global.CombatManager.EnemyAt(X, tempY);
             if (enemy == null)
             {
                 // When there is not an enemy, move as normal
                 Y = tempY;
             }
             else
             {
                 // When there is an enemy in the cell, make an
                 // attack against them by using the CombatManager
                 Global.CombatManager.Attack(this, enemy);
             }
             return true;
         }
     }
     else if (inputState.IsDown(PlayerIndex.One))
     {
         int tempY = Y + 1;
         if (map.IsWalkable(X, tempY))
         {
             // Check to see if there is an enemy at the location
             // that the player is attempting to move into
             var enemy = Global.CombatManager.EnemyAt(X, tempY);
             if (enemy == null)
             {
                 // When there is not an enemy, move as normal
                 Y = tempY;
             }
             else
             {
                 // When there is an enemy in the cell, make an
                 // attack against them by using the CombatManager
                 Global.CombatManager.Attack(this, enemy);
             }
             return true;
         }
     }
     return false;
 }