private tnTeamDescription CreateTeam(int i_TeamKey, int i_TeamSize, Color i_TeamColor)
        {
            tnTeamData teamData = tnGameData.GetTeamDataMain(i_TeamKey);

            if (teamData == null || i_TeamSize <= 0)
            {
                return(null);
            }

            tnTeamDescription teamDescription = new tnTeamDescription();

            teamDescription.SetTeamId(i_TeamKey);
            teamDescription.SetTeamColor(i_TeamColor);

            List <int> teamLineup = teamData.GetDefaultLineUp(i_TeamSize);

            for (int characterIndex = 0; characterIndex < teamLineup.Count; ++characterIndex)
            {
                int characterKey = teamLineup[characterIndex];

                tnCharacterDescription characterDescription = new tnCharacterDescription();
                characterDescription.SetCharacterId(characterKey);
                characterDescription.SetPlayerId(StringUtils.s_NULL);
                characterDescription.SetSpawnOrder(characterIndex);

                teamDescription.AddCharacterDescription(characterDescription);
            }

            return(teamDescription);
        }
コード例 #2
0
        public override void OnEnter()
        {
            tnTeamsModule teamsModule = GameModulesManager.GetModuleMain <tnTeamsModule>();

            if (teamsModule == null)
            {
                teamsModule = GameModulesManager.AddModuleMain <tnTeamsModule>();
                teamsModule.Clear();
            }

            tnTeamDescription team = new tnTeamDescription();

            team.SetTeamId(id.Value);
            team.SetTeamColor(color.Value);

            int charactersCount = characters.Length;

            for (int characterIndex = 0; characterIndex < charactersCount; ++characterIndex)
            {
                tnCharacterEntry entry = characters[characterIndex];
                if (entry != null)
                {
                    FsmString characterId       = entry.characterId;
                    FsmInt    onlinePlayerIndex = entry.onlinePlayerIndex;
                    FsmString playerId          = entry.playerId;
                    FsmInt    spawnOrder        = entry.spawnOrder;

                    if (characterId != null && !characterId.IsNone && onlinePlayerIndex != null && !onlinePlayerIndex.IsNone && playerId != null && !playerId.IsNone && spawnOrder != null && !spawnOrder.IsNone)
                    {
                        tnCharacterDescription character = new tnCharacterDescription();

                        character.SetCharacterId(characterId.Value);

                        character.SetOnlinePlayerIndex(onlinePlayerIndex.Value);

                        character.SetPlayerId(playerId.Value);
                        character.SetSpawnOrder(spawnOrder.Value);

                        team.AddCharacterDescription(character);
                    }
                }
            }

            teamsModule.AddTeamDescription(team);

            Finish();
        }
コード例 #3
0
    private void Internal_AddTeamB(tnTeamsModule i_TeamsModule, int i_CharacterCount)
    {
        if (i_TeamsModule == null)
        {
            return;
        }

        tnTeamDescription teamDescription = new tnTeamDescription();

        string teamId = GetTeamB();

        teamDescription.SetTeamId(teamId);

        Color teamColor = GetTeamBColor();

        teamDescription.SetTeamColor(teamColor);

        if (i_CharacterCount >= 0)
        {
            tnTeamData teamData = tnGameData.GetTeamDataMain(teamId);
            if (teamData != null)
            {
                int characterCount = Mathf.Min(i_CharacterCount, teamData.charactersCount);
                for (int index = 0; index < characterCount; ++index)
                {
                    tnCharacterDescription characterDescription = new tnCharacterDescription();
                    characterDescription.SetCharacterId(teamData.GetCharacterKey(index));
                    characterDescription.SetSpawnOrder(index);

                    if (m_AllHumans)
                    {
                        characterDescription.SetPlayerId(GetPlayerIdByIndex(index + characterCount));
                    }

                    teamDescription.AddCharacterDescription(characterDescription);
                }
            }
        }

        i_TeamsModule.AddTeamDescription(teamDescription);
    }