Esempio n. 1
0
        public void Start()
        {
            this.someMap = new Map(MapType.Easy);
            this.HumanPlayer = new Player(new Coordinates(PlayerStartCoordinateX, PlayerStartCoordinateY), this.PlayerType);
            this.DrawAll();
            this.InitializeObjects();

            this.inputInterface.OnLeftPressed += this.MovePlayer;
            this.inputInterface.OnRightPressed += this.MovePlayer;
            this.inputInterface.OnUpPressed += this.MovePlayer;
            this.inputInterface.OnDownPressed += this.MovePlayer;

            while (true)
            {
                this.inputInterface.ProcessInput();
                this.DrawAll();
            }
        }
Esempio n. 2
0
        private static void CheckForValidCommand()
        {
            bool isValidCommand = false;

            while (isValidCommand == false)
            {
                Console.SetCursorPosition(27, 16);
                Console.ForegroundColor = ConsoleColor.Cyan;
                string userCommand = Console.ReadLine().ToLower();

                if (userCommand == "1")
                {
                    isValidCommand = true;
                    SimulateLoading();
                    Console.Clear();
                    Map someMap = new Map(MapType.Easy);
                    someMap.DrawMap();
                }
                else if (userCommand == "2")
                {
                    isValidCommand = true;
                    SimulateLoading();
                    Console.Clear();
                    Map someMap = new Map(MapType.Medium);
                    someMap.DrawMap();
                }
                else if (userCommand == "3")
                {
                    isValidCommand = true;
                    SimulateLoading();
                    Console.Clear();
                    Map someMap = new Map(MapType.Hard);
                    someMap.DrawMap();
                }
                else if (userCommand == "back")
                {
                    isValidCommand = true;
                    optionCursorPosition = 0;
                    Console.Clear();
                    StartMenuPrint();
                }
                else
                {
                    Console.SetCursorPosition(6, 20);
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("Command is NOT VALID! Please try again!");

                    InvalidCommandRemove(userCommand);
                }
            }
        }