예제 #1
0
    void Start()
    {
        int rscCount = GameControl.GetResourceCount();

        if (defaultPath == null)
        {
            defaultPath = (PathTD)FindObjectOfType(typeof(PathTD));
        }

        if (autoGenWave)
        {
            InitAutoGenCreepPara();
            if (spawnLimit == _SpawnLimit.Finite)
            {
                for (int i = 0; i < waves.Length; i++)
                {
                    waves[i] = GenerateWave(i);
                }
            }
        }
        else
        {
            //prespawn the unit
            foreach (Wave wave in waves)
            {
                foreach (SubWave subWave in wave.subWaves)
                {
                    if (subWave.unit != null)
                    {
                        UnitCreep unit = subWave.unit.GetComponent <UnitCreep>();
                        //make sure the creep value length match the resource count
                        if (unit != null)
                        {
                            unit.InitValue(rscCount);
                        }
                        ObjectPoolManager.New(subWave.unit, subWave.count);
                    }
                }
            }
        }

        //LoadCreep();
    }