Example #1
0
    private IEnumerator RoundEnding()
    {
        // Clear the winner from the previous round.
        m_RoundWinner = null;

        // See if there is a winner now the round is over.
        m_RoundWinner = GetRoundWinner();

        // If there is a winner, increment their score.
        if (m_RoundWinner != null)
        {
            m_RoundWinner.m_Wins++;
        }

        // Now the winner's score has been incremented, see if someone has one the game.
        m_GameWinner = GetGameWinner();

        RpcUpdateMessage(EndMessage(0));

        //notify client they should disable player control
        RpcRoundEnding();

        // Wait for the specified length of time until yielding control back to the game loop.
        yield return(m_EndWait);
    }
    private WaitForSeconds m_StartWait; // Used to have a delay whilst the round starts.

    #endregion Fields

    #region Methods

    // int playerNum, Color c, string name, int localID);
    /// <summary>
    /// Add a player from the lobby hook
    /// </summary>
    /// <param name="player">The actual GameObject instantiated by the lobby, which is a NetworkBehaviour</param>
    /// <param name="lobbyPlayer">The Lobby Player</param>
    /// lp.slot, lp.playerColor, lp.nameInput.text, lp.playerControllerId
    public static void AddPlayer(GameObject player, LobbyPlayer lobbyPlayer)
    {
        PlayMakerSanPlayerManager tmp = new PlayMakerSanPlayerManager();
        tmp.m_Instance = player;
        tmp.m_PlayerNumber = lobbyPlayer.playerControllerId;
        tmp.m_PlayerColor = lobbyPlayer.playerColor;
        tmp.m_PlayerName = lobbyPlayer.nameInput.name;
        tmp.m_LocalPlayerID = lobbyPlayer.playerControllerId;
        tmp.Setup();

        m_Players.Add(tmp);
    }
Example #3
0
    public void RemovePlayer(GameObject player)
    {
        PlayMakerSanPlayerManager toRemove = null;

        foreach (var tmp in m_Players)
        {
            if (tmp.m_Instance == player)
            {
                toRemove = tmp;
                break;
            }
        }

        if (toRemove != null)
        {
            m_Players.Remove(toRemove);
        }
    }
    private IEnumerator RoundEnding()
    {
        // Clear the winner from the previous round.
        m_RoundWinner = null;

        // See if there is a winner now the round is over.
        m_RoundWinner = GetRoundWinner();

        // If there is a winner, increment their score.
        if (m_RoundWinner != null)
            m_RoundWinner.m_Wins++;

        // Now the winner's score has been incremented, see if someone has one the game.
        m_GameWinner = GetGameWinner();

        RpcUpdateMessage(EndMessage(0));

        //notify client they should disable player control
        RpcRoundEnding();

        // Wait for the specified length of time until yielding control back to the game loop.
        yield return m_EndWait;
    }