コード例 #1
0
    private GameObject SpawnAI(AI_TYPE InType, AI_LEVEL InLevel, GameObject InParent)
    {
        // for test
        InLevel = (AI_LEVEL)Mathf.Min((int)InLevel, AI_Level_Limit[(int)InType]);

        AIData     AIToSpawn  = List_AIData.Find(it => InType == it.type && InLevel == it.level);
        string     prefabName = AIData.AI_Name[(int)AIToSpawn.type] + (int)AIToSpawn.level;
        GameObject AI         = Resources.Load(Config.Folder_AITraffic + prefabName) as GameObject;

        AI = Instantiate(AI, InParent.transform.position - InParent.GetComponent <TrafficStation>().Offset, Quaternion.identity);

        return(AI);
    }
コード例 #2
0
    public IEnumerator SendAI(AI_TYPE InType, AI_LEVEL InLevel, GameObject InParent)
    {
        List <GameObject> List_AI;

        if (!Map_AI.TryGetValue(InType, out List_AI))
        {
            List_AI = new List <GameObject>();
            Map_AI.Add(InType, List_AI);
        }

        for (int i = 0; i < (int)InLevel; i++)
        {
            GameObject AI = SpawnAI(InType, (AI_LEVEL)i, InParent);
            AI.GetComponent <TrafficAI>().type = InType;

            List_AI.Add(AI);

            yield return(new WaitForSeconds(2));
        }
    }
コード例 #3
0
 public AIData(AI_TYPE InType, AI_LEVEL InLevel)
 {
     type  = InType;
     level = InLevel;
 }