예제 #1
0
        public void MoveSwitch(ConsoleKey input)
        {
            if (!IsPlaying)
            {
                return;
            }

            ConsoleKey[] keys = { ConsoleKey.D1, ConsoleKey.D2, ConsoleKey.D3, ConsoleKey.D4, ConsoleKey.D5 };

            if (keys.Contains(input))
            {
                PlayingGround.MoveSwitch(Array.IndexOf(keys, input) + 1);
                OutputView.PrintPlayground(PlayingGround);
                InputView.PrintGameInstruction();
            }
        }
예제 #2
0
        public void TimerTick(object sender, ElapsedEventArgs eventArgs)
        {
            PlayingGround.MoveVehicles();
            PlayingGround.SpawnNewCarts();

            OutputView.PrintPlayground(PlayingGround);

            if (!IsPlaying)
            {
                Timer.Stop();
                Timer.Dispose();

                OutputView.PrintEndGame(Score);
                return;
            }

            InputView.PrintGameInstruction();
        }