예제 #1
0
        Wave convertSpritesToWave(GameObject[] slots)
        {
            Wave wave = new Wave();

            for (int i = 0; i < slots.Length; i++)
            {
                Transform[] ts = slots[i].GetComponentsInChildren <Transform>();
                foreach (Transform t in ts)
                {
                    if (t.name.ToLower().Contains("image"))
                    {
                        foreach (GameObject go in minions)
                        {
                            Minion m = go.GetComponent <Minion>();
                            if (m.sprite == t.GetComponent <Image>().sprite)
                            {
                                WaveSection section = new WaveSection();
                                section.minion = go;
                                section.count  = minionCount[m.minionName];
                                section.rate   = 1;
                                wave.sections.Add(section);
                            }
                        }
                    }
                }
            }
            return(wave);
        }
예제 #2
0
 IEnumerator spawnWaveSection(WaveSection section)
 {
     for (int i = 0; i < section.count; i++)
     {
         spawnMinion(section.minion);
         yield return(new WaitForSeconds(1 / section.rate));
     }
 }
예제 #3
0
        Wave convertGameobjectsToWave(GameObject[] gos)
        {
            Wave wave = new Wave();
            Dictionary <string, int> minionCount = minionManagement.getMinionCounts();

            for (int i = 0; i < gos.Length; i++)
            {
                Minion      m  = gos[i].GetComponent <Minion>();
                WaveSection ws = new WaveSection();
                ws.minion = gos[i];
                ws.rate   = 1;
                ws.count  = minionCount[m.minionName];
                wave.sections.Add(ws);
            }
            return(wave);
        }