Esempio n. 1
0
        //public UtilityFunctions Utility {
        //    get {
        //        return _utility;
        //    }
        //}

        public GameController(GameResources res)
        {
            _state = new Stack <GameState>();
            //bottom state will be quitting. If player exits main menu then the game is over
            _state.Push(GameState.Quitting);

            //at the start the player is viewing the main menu
            _state.Push(GameState.ViewingMainMenu);

            _resources = res;

            _utility    = new UtilityFunctions();
            _menu       = new MenuController();
            _deployment = new DeploymentController();
            _discovery  = new DiscoveryController();
            _endGame    = new EndingGameController();
            _highScore  = new HighScoreController();

            _highScore.LoadHighScore();
        }
Esempio n. 2
0
        /*<summary>
         * Draws the current state of the game to the screen.
         *</summary>
         *<remarks>
         * What is drawn depends upon the state of the game.
         *</remarks>
         */
        public static void DrawScreen()
        {
            UtilityFunctions.DrawBackground();
            switch (CurrentState)
            {
            case GameState.ViewingMainMenu:
                MenuController.DrawMainMenu();
                break;

            case GameState.ViewingGameMenu:
                MenuController.DrawGameMenu();
                break;

            case GameState.AlteringSettings:
                MenuController.DrawSettings();
                break;

            case GameState.AlteringShips:
                MenuController.DrawShipsMenu();
                break;

            case GameState.Deploying:
                DeploymentController.DrawDeployment();
                break;

            case GameState.Discovering:
                DiscoveryController.DrawDiscovery();
                break;

            case GameState.EndingGame:
                EndingGameController.DrawEndOfGame();
                break;

            case GameState.ViewingHighScores:
                HighScoreController.DrawHighScores();
                break;
            }
            UtilityFunctions.DrawAnimations();
            SwinGame.RefreshScreen();
        }
Esempio n. 3
0
        /*<summary>
         * Handles the user SwinGame.
         *</summary>
         *<remarks>
         * Reads key and mouse input and converts these into
         * actions for the game to perform. The actions
         * performed depend upon the state of the game.
         *</remarks>
         */
        public static void HandleUserInput()
        {
            // Read incoming input events
            SwinGame.ProcessEvents();
            switch (CurrentState)
            {
            case GameState.ViewingMainMenu:
                MenuController.HandleMainMenuInput();
                break;

            case GameState.ViewingGameMenu:
                MenuController.HandleGameMenuInput();
                break;

            case GameState.AlteringSettings:
                MenuController.HandleSetupMenuInput();
                break;

            case GameState.AlteringShips:
                MenuController.HandleShipsMenuInput();
                break;

            case GameState.Deploying:
                DeploymentController.HandleDeploymentInput();
                break;

            case GameState.Discovering:
                DiscoveryController.HandleDiscoveryInput();
                break;

            case GameState.EndingGame:
                EndingGameController.HandleEndOfGameInput();
                break;

            case GameState.ViewingHighScores:
                HighScoreController.HandleHighScoreInput();
                break;
            }
            UtilityFunctions.UpdateAnimations();
        }