public void CreateTeamAIFactory(int i_TeamIndex, tnTeamDescription i_TeamDescription) { if (!m_SetupDone) { return; } if (i_TeamIndex < 0 || i_TeamIndex >= m_AIFactories.Length || i_TeamIndex >= m_TeamSizes.Length) { return; } if (i_TeamDescription == null) { return; } ClassTypeReference newAIFactoryType = (i_TeamIndex % 2 == 0) ? m_EvenTeamAIFactoryType : m_OddTeamAIFactoryType; tnBaseSubbuteoMatchAIFactory newAIFactory = CSharpUtils.Cast <tnBaseSubbuteoMatchAIFactory>(Activator.CreateInstance(newAIFactoryType)); if (newAIFactory != null) { newAIFactory.Configure(i_TeamDescription); } m_AIFactories[i_TeamIndex] = newAIFactory; m_TeamSizes[i_TeamIndex] = i_TeamDescription.charactersCount; }
public tnBaseAIInputFiller CreateAIInputFiller(int i_TeamIndex, int i_Index, GameObject i_Character) { if (!m_SetupDone) { return(new tnNullBaseAIInputFiller(i_Character)); } if (i_TeamIndex < 0 || i_TeamIndex >= m_AIFactories.Length) { return(new tnNullBaseAIInputFiller(i_Character)); } tnBaseSubbuteoMatchAIFactory aiFactory = m_AIFactories[i_TeamIndex]; if (aiFactory != null) { return(aiFactory.CreateAI(i_Index, i_Character)); } return(new tnNullBaseAIInputFiller(i_Character)); }