예제 #1
0
파일: Controls.cs 프로젝트: dgorb/Hex
        public static void Update()
        {
            KeyboardState currentState = Keyboard.GetState();
            MouseState    mouseState   = Mouse.GetState();

            /* End current player's turn after Space is pressed. */
            if (currentState.IsKeyDown(Keys.Space) && previousState.IsKeyUp(Keys.Space))
            {
                TurnManager.ChangeTurn();
            }

            /* Move current unit */
            if (currentState.IsKeyDown(Keys.M) && previousState.IsKeyUp(Keys.M))
            {
                Units.Unit currentUnit = UnitManager.GetCurrentUnit();
                if (currentUnit.State != Units.Unit.States.Moving)
                {
                    MoveManager.StartMove(currentUnit);
                }
                else if (currentUnit.State == Units.Unit.States.Moving)
                {
                    MoveManager.EndMove(currentUnit);
                }
            }

            previousState = currentState;
        }