예제 #1
0
    public void ExitGame()
    {
        ProfileInfo.SaveProfileInfos();
        PlayerManager.ReinitializeAllPlayerManagers();

        MainMenu.MainMenuSingleton().SetActive(true);
        MainMenu.MainMenuSingleton().OnPlayButton();
        m_gameCamera.gameObject.SetActive(false);
        m_menuCamera.gameObject.SetActive(true);
        m_ingameMenu.gameObject.SetActive(false);
        m_gameUI.gameObject.SetActive(false);

        if (m_isSolo)
        {
            m_soloManager.RemoveTokens();
        }
        else
        {
            RoundManager.Singleton().RemoveTokens();
        }

        m_isSolo  = false;
        m_isMulti = false;

        PlayIntroMusic();
        StopCoroutine(GameLoop());
        MainNetworkManager.Singleton().StopHost();
        MainNetworkManager.Singleton().StopClient();
    }
예제 #2
0
    public void OnBack(string currentMenu)
    {
        switch (currentMenu)
        {
        case "Play":
            SetCurrentMenu(m_startMenu);
            break;

        case "Lobby":
            if (SetCurrentMenu(m_playMenu))
            {
                MainNetworkManager.Singleton().StopHost();
                MainNetworkManager.Singleton().StopClient();
                m_lobbyMenu.GetComponent <LobbyMenu>().ExitLobby();
                PlayerManager.ReinitializeAllPlayerManagers();
            }
            break;

        case "Profile":
            SetCurrentMenu(m_playMenu);
            break;

        case "NewProfile":
        case "ModifyProfile":
        case "Stats":
            SetCurrentMenu(m_profileMenu);
            break;
        }
    }
예제 #3
0
 private void OnDestroy()
 {
     //Make sure we clear the instance static variable to be able to recreate it later
     if (_instance == this)
     {
         _instance = null;
     }
 }
    public void Start()
    {
        // Network Discovery
        m_discovery = GetComponent <CustomNetworkDiscovery>();
        m_discovery.CustomInitialize();

        s_singleton = this;
    }
예제 #5
0
    void Awake()
    {
        //Check if we already got an instance, if so delete the object
        if (_instance != null)
        {
            Destroy(gameObject);
            return;
        }

        //Create a new instance of the instance
        _instance = this;
        //Dont destroy the object on load
        DontDestroyOnLoad(gameObject);
        //Set state
        State            = ENetworkState.IDLE;
        PlayersConnected = new List <NetworkPlayer>();
    }
예제 #6
0
    public void OnSoloGame()
    {
        if (!ProfileInfo.ProfileInfosLoaded())
        {
            SetCurrentMenu(m_newProfileMenu);
            return;
        }

        if (SetCurrentMenu(m_soloMenu))
        {
            MainNetworkManager.Singleton().StopHost();
            MainNetworkManager.Singleton().StopClient();

            MainNetworkManager.Singleton().StartHost();
            GameManager.Singleton().StartSoloGame();
        }
    }
예제 #7
0
    public void StartGame()
    {
        List <PlayerManager> allPlayerManagers = PlayerManager.AllPlayerManagers();

        foreach (PlayerManager playerManager in allPlayerManagers)
        {
            playerManager.InitializeIngame();
        }

        MainMenu.MainMenuSingleton().gameObject.SetActive(false);
        m_menuCamera.gameObject.SetActive(false);
        m_gameCamera.gameObject.SetActive(true);
        m_ingameMenu.gameObject.SetActive(true);
        m_isMulti = true;

        PlayIngameMusic();
        MainNetworkManager.Singleton().StopDiscovery();
        RoundManager.Singleton().ResetRoundManager();
        StartCoroutine(GameLoop());
    }