Exemple #1
0
    public void ConfirmPlayerReadyToServer(int confirmingPlayerID, int confirmedPlayerID)
    {
        //Only Server's responsible for all the confirm information
        if (!Network.isServer)
        {
            return;
        }

        // Debug.Log("Server Message: Player " + confirmingPlayerID + " is confirming Player " +
        //  confirmedPlayerID + " is ready to start the game.");

        //validate ID
        if (!allPlayers.ContainsKey(confirmingPlayerID))
        {
            // TODO: error handling
            Debug.Log("Server Message: WARNING!!! Unrecognized confirming playerID: " + confirmingPlayerID);
            return;
        }
        if (!allPlayers.ContainsKey(confirmedPlayerID))
        {
            // TODO: error handling
            Debug.Log("Server Message: WARNING!!! Unrecognized confirmed playerID: " + confirmingPlayerID);
            return;
        }

        //relay message to confirmed client
        // if (_localPlayerIndex.Equals(confirmedPlayerID)) {
        //don't need an rpc call if we are the server
        // ReceiptPlayerReadyToClient(confirmingPlayerID, confirmedPlayerID);
        // } else {
        _networkInterface.CallReceiptPlayerReadyToClient(confirmingPlayerID, confirmedPlayerID);
        // }
    }