Example #1
0
        private void StartGame()
        {
            _setting = GetCurrSetting();
            //save current setting
            Levels.SetSettings(_setting, _diffIndex);

            _gameLogic = new WumpusGameLogic(_setting, _dataAccess);
            SetGameEventHandlers();
            try
            {
                if (_setting.Size > 50)
                {
                    throw new Exception();
                }
                SetExtraSettings();

                //start the game
                _gameLogic.StartGame();

                ActSize  = _setting.Size;
                ActArrow = _gameLogic.PlayerArrows;
                OnPropertyChanged("ActSize");

                UpdateField();
                Info       = "Mit cselekszel? Mozogni a nyíl gombokkal illetve a nyíl billentyűkkel is tudsz!";
                ActPosText = "Beléptél a barlangba, a bal alsó sarkában vagy.";
            }
            catch (Exception)
            {
                MessageBox.Show("Hibás játékparaméterek! Kérlek Figyelj, hogy értelmes adatokat adj meg!", "Hiba", MessageBoxButton.OK, MessageBoxImage.Error);
                _gameLogic = new WumpusGameLogic();
            }
        }
Example #2
0
        private static void SetGame(WumpusGameLogic game)
        {
            _game = game;

            _game.GameOverEvent    += WumpusGameOverEvent;
            _game.OutOfFieldEvent  += WumpusOutOfFieldEvent;
            _game.SucceccStepEvent += WumpusSucceccStepEvent;
            if (!_game.IsStarted)
            {
                _game.StartGame();
                System.Console.WriteLine("\n\nBeléptél a barlangba, a bal alsó sarkában vagy.\n" +
                                         "A barlang mérete: " + _game.Setting.Size + " x " + _game.Setting.Size);
                _lastSetting = _game.Setting;
            }
            //System.Console.WriteLine("Csapdák száma: " + game.Setting.TrapNumberMin + ".." + game.Setting.TrapNumberMax);
            WriteSenses();
            Game();
            //System.Console.ReadKey();
        }