コード例 #1
0
        private void UpdateTeamList(CustomRoomOptions.Team team, ref List <PlayerListNode> teamNodeList, ref List <PhotonPlayer> playerList)
        {
            // Load player list form server.
            PhotonPlayer[] totalplayerList = PhotonNetwork.playerList;

            playerList.Clear();

            foreach (var player in totalplayerList)
            {
                if (CustomRoomOptions.GetTeam((int)player.customProperties[PlayerProperties.Team])
                    == team)
                {
                    playerList.Add(player);
                }
            }

            playerList.Sort(ComparerScore);

            for (int index = 0; index < teamNodeList.Count; index++)
            {
                if (index < playerList.Count)
                {
                    teamNodeList[index].ShowNode(true);
                    teamNodeList[index].SetInfo(playerList[index].isLocal,
                                                (index + 1).ToString(), playerList[index].name,
                                                (playerList[index].GetScore()));
                }
                else
                {
                    teamNodeList[index].ShowNode(false);
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Check if the target team is full or not.
        /// </summary>
        /// <param name="team">The team you wanna check.</param>
        /// <returns>Return TRUE if team is full.</returns>
        public static bool CheckIfTeamFull(CustomRoomOptions.Team team)
        {
            PhotonPlayer[] playerlist      = PhotonNetwork.playerList;
            int            currentTeamSize = 0;

            foreach (var player in playerlist)
            {
                if (player.customProperties.ContainsKey(PlayerProperties.Team))
                {
                    // If the player's team is match with what we are looking for.
                    if (CustomRoomOptions.GetTeam((int)player.customProperties[PlayerProperties.Team]) == team)
                    {
                        currentTeamSize++;
                    }
                }
                else
                {
                    Debug.LogError("Player property TEAM is not exist.");
                    return(false);
                }
            }

            if (currentTeamSize >= (PhotonNetwork.room.maxPlayers / 2))
            {
                Debug.LogError("Any one side of team's menber should not more than half of the maximun player count.");
                return(false);
            }

            return(currentTeamSize == PhotonNetwork.room.maxPlayers);
        }
コード例 #3
0
        public override Transform GetSpawnPoint(CustomRoomOptions.Team team)
        {
            switch (team)
            {
            case CustomRoomOptions.Team.OneManArmy:
                return(SpawnPointsManager.Instance.GetAvailableSpwanPoint(SpawnPointsManager.GetSwpanPointMode.Random));

            case CustomRoomOptions.Team.Blue:
                return(SpawnPointsManager.Instance.GetAvailableSpwanPoint(SpawnPointsManager.GetSwpanPointMode.GetBlueOnly));

            case CustomRoomOptions.Team.Red:
                return(SpawnPointsManager.Instance.GetAvailableSpwanPoint(SpawnPointsManager.GetSwpanPointMode.GetRedOnly));

            default:
                return(null);
            }
        }
コード例 #4
0
 /// <summary>
 /// Use this method to synchronize every client which team this character's object is in.
 /// </summary>
 /// <param name="team"></param>
 public void SetTeam(CustomRoomOptions.Team team)
 {
     this.photonView.RPC("SyncTeam", PhotonTargets.AllBuffered, (int)team);
 }
コード例 #5
0
ファイル: GameModeBase.cs プロジェクト: LarryThe4th/BoxHound
 /// <summary>
 /// Get spawn point for player object to respawn.
 /// </summary>
 /// <param name="team">Which team does the player object belong to.</param>
 /// <returns></returns>
 public abstract Transform GetSpawnPoint(CustomRoomOptions.Team team);
コード例 #6
0
ファイル: FreeForAll.cs プロジェクト: LarryThe4th/BoxHound
 public override Transform GetSpawnPoint(CustomRoomOptions.Team team)
 {
     return(SpawnPointsManager.Instance.GetAvailableSpwanPoint(SpawnPointsManager.GetSwpanPointMode.Random));
 }