Ejemplo n.º 1
0
        private void KeyHandler(KeyEventArgs eventArgs)
        {
            var direction = MoveDirection.Down;

            if (directions.ContainsKey(eventArgs.KeyCode))
            {
                var moveDirection = directions[eventArgs.KeyCode];
                if (!map.IsPlayerBoost)
                {
                    playerImage = images[$"pacman-{moveDirection.ToString().ToLower()}.png"];
                }
                else
                {
                    playerImage = images[$"pacman-{moveDirection.ToString().ToLower()}-angry.png"];
                }
                direction = moveDirection;
            }

            map.SetPlayerMoveDirection(direction);
        }