コード例 #1
0
        public void LeavePlayer(EPlayerID playerID)
        {
            if ((IS_KEY_CONTAINED(partyStatusMap, playerID)) &&
                (IS_TRUE(partyStatusMap[playerID].HasJoined)))
            {
                // Destroy Player
                if (ActivePlayers.ContainsKey(playerID))
                {
                    DestroyPlayer(playerID);
                }

                // Reset controller to Spectator
                EControllerID controllerID = partyStatusMap[playerID].ControllerID;
                if (IS_KEY_CONTAINED(ControllersMap, controllerID))
                {
                    ControllersMap[controllerID] = EPlayerID.SPECTATOR;
                }

                // Reset entry of playerID in party status
                partyStatusMap[playerID] = new PlayerJoinStatus(EControllerID.NONE);

                // Trigger global event
                BEventsCollection.PLAYERS_PlayerLeft.Invoke(new BEHandle <EPlayerID, EControllerID>(playerID, controllerID));

                // Are the rest of the joined players ready?
                CheckIfAllPlayersAreReady();
            }
        }
コード例 #2
0
 public bool HasPlayerJoined(EPlayerID playerID)
 {
     foreach (KeyValuePair <EPlayerID, PlayerJoinStatus> pair in partyStatusMap)
     {
         PlayerJoinStatus playerJoinStatus = pair.Value;
         if ((playerID == pair.Key) &&
             (playerJoinStatus.HasJoined == true))
         {
             return(true);
         }
     }
     return(false);
 }
コード例 #3
0
        public List <EPlayerID> GetJoinedPlayers()
        {
            List <EPlayerID> result = new List <EPlayerID>();

            foreach (KeyValuePair <EPlayerID, PlayerJoinStatus> pair in partyStatusMap)
            {
                PlayerJoinStatus playerJoinStatus = pair.Value;
                if (playerJoinStatus.HasJoined == true)
                {
                    result.Add(pair.Key);
                }
            }
            return(result);
        }
コード例 #4
0
        private EPlayerID GetNextNotJoinedPlayerID()
        {
            foreach (var pair in partyStatusMap)
            {
                EPlayerID        playerID         = pair.Key;
                PlayerJoinStatus playerJoinStatus = pair.Value;

                if (playerJoinStatus.HasJoined == false)
                {
                    return(playerID);
                }
            }
            return(EPlayerID.NONE);
        }
コード例 #5
0
        private EPlayerID JoinNextAIPlayer(EControllerID controllerID)
        {
            foreach (var pair in partyStatusMap)
            {
                EPlayerID        playerID         = pair.Key;
                PlayerJoinStatus playerJoinStatus = pair.Value;

                if (playerJoinStatus.HasJoined == false)
                {
                    JoinPlayer(playerID, controllerID);
                    return(playerID);
                }
            }
            return(EPlayerID.NONE);
        }