Пример #1
0
        public static void ReadCommand(object sender, EventArgs args)
        {
            GameManager gameManager = (sender as GameManager);

            if (gameManager != null)
            {
                var command = Console.ReadLine().Split(commandSeparators, splitOptions);

                try
                {
                    switch (command[0])
                    {
                    case "goto":
                        HandleChangeLocation(gameManager, command[1]);
                        break;

                    case "fight":
                        HandleAttackEnemy(gameManager, command[1]);
                        break;

                    //case "pickup":
                    //    HandleItemPickUp(gameManager, command[1]);
                    //    break;
                    //case "drop":
                    //    HandleItemDrop(gameManager, command[1]);
                    //    break;
                    //case "use":
                    //    HandleItemUse(gameManager, command[1]);
                    //    break;
                    default:
                        HandleInvalidCommand(command[0]);
                        break;
                    }
                }
                catch (GameObjectNotFoundException e)
                {
                    ConsoleRenderer.AddNotification(new Notification(e.Message, NotificationType.Error));
                }
            }
        }