Exemple #1
0
        // -------------------------------------------

        /*
         * Constructor
         */
        void Start()
        {
            GameEventController.Instance.GameEvent       += new GameEventHandler(OnGameEvent);
            UIEventController.Instance.UIEvent           += new UIEventHandler(OnScreenVREvent);
            NetworkEventController.Instance.NetworkEvent += new NetworkEventHandler(OnNetworkEvent);

            TeleportController.Instance.Initialize();
            LocalPlayerController.Instance.Initialize();
            LanguageController.Instance.Initialize();
            FXController.Instance.Initialize();
            ShootsController.Instance.Initialize();
            PowerUpsController.Instance.Initialize();
            EnemiesController.Instance.Initialize();
            PlayersController.Instance.Initialize();
            PathFindingController.Instance.Initialize();
            LevelBuilderController.Instance.Initialize();
            SoundsController.Instance.Initialize();
            KeysEventInputController.Instance.Initialization();

            m_isMultiplayer = false;

            // START AS A MASTER OR AS A CLIENT
            m_totalPlayersConfigurated = MultiplayerConfiguration.LoadNumberOfPlayers();
            if ((m_totalPlayersConfigurated == -1) || (m_totalPlayersConfigurated == 1))
            {
                m_connectionPlayersInitialized = 1;
                m_isMultiplayer = false;
            }
            else if (m_totalPlayersConfigurated == MultiplayerConfiguration.VALUE_FOR_JOINING)
            {
                m_connectionPlayersInitialized = 1000;
                m_totalPlayersConfigurated     = 1000;
                m_isMultiplayer = true;
            }
            else if (m_totalPlayersConfigurated > 1)
            {
                m_connectionPlayersInitialized = m_totalPlayersConfigurated;
                m_isMultiplayer = true;
            }

            m_level       = INITIAL_LEVEL;
            m_globalLifes = TOTAL_GLOBAL_LIFES;
            SetState(-1);
        }
        // -------------------------------------------

        /*
         * ConfirmNumberPlayers
         */
        private void ConfirmNumberPlayers()
        {
            bool loadNextScreen = true;

            if (loadNextScreen)
            {
                SoundsController.Instance.PlaySingleSound(SoundsConfiguration.SOUND_SELECTION_FX);
                if (MenuScreenController.Instance.EnableAppOrganization)
                {
                    UIEventController.Instance.DispatchUIEvent(EVENT_SCREENNUMBERPLAYERS_SET_NUMBER_PLAYERS, FinalNumberOfPlayers);
                    GoBackPressed();
                }
                else
                {
                    UIEventController.Instance.DispatchUIEvent(MenuScreenController.EVENT_MENUEVENTCONTROLLER_CREATED_NEW_GAME, FinalNumberOfPlayers);
                    MultiplayerConfiguration.SaveDirectorMode(MultiplayerConfiguration.DIRECTOR_MODE_DISABLED);
                    MenuScreenController.Instance.LoadCustomGameScreenOrCreateGame(false, FinalNumberOfPlayers, "", null);
                }
            }
        }