コード例 #1
0
    public void RpcEndGame()
    {
        SetReady(false);

        if (isLocalPlayer)
        {
            GUIManagerScript.SetButton(true);

            GUIManagerScript.SetBackButton(false);

            AudioManagerScript.instance.EndGameMusic();

            AudioManagerScript.instance.PlayRoundEnd(scored_GuessedCorrect);

            GUIManagerScript.HideClassicGameParent();

            GUIManagerScript.SetSongSetButton(true);
        }
    }
コード例 #2
0
    // Redundant? Possible. But I am not sure
    // Unity says this is the one to use, yet OnDestroy works and possibly works better?
    // Let's do both to be safe.
    new void OnDestroy()
    {
        //print("Player was was destroyed");
        if (playerButton != null)
        {
            Destroy(playerButton);
        }

        if (isLocalPlayer)
        {
            GUIManagerScript.SetPregameParent(false);
            GUIManagerScript.SetButton(false);
            GUIManagerScript.SetRulesButton(false);
            GUIManagerScript.SetBackButton(false);
            GUIManagerScript.HideClassicGameParent();
            GUIManagerScript.SetSongSetButton(false);
            if (GUIManagerScript.countdownText != null)
            {
                GUIManagerScript.countdownText.enabled = false;
            }

            if (AudioManagerScript.instance != null)
            {
                AudioManagerScript.instance.StopSFX();
                AudioManagerScript.instance.EndGameMusic();
                AudioManagerScript.instance.StartMenuMusic();
            }
        }

        // If this is a client player on the server then OnClientExitLobby will not be called.
        // Call it here instead.
        if (networkManager.IsHost() && networkManager.localPlayer != this)
        {
            OnClientExitLobby();
        }

        base.OnDestroy();
    }