public void SpawnLilypad() { LilypadController newlily; if (lilypadsPull.Count <= 0) { newlily = Instantiate(SpawnInfo.GetRandomSpawnable(), transform).GetComponent <LilypadController>(); lilypadsActive.Add(newlily); } else { newlily = lilypadsPull[0]; lilypadsActive.Add(newlily); lilypadsPull.RemoveAt(0); } newlily.Init(); newlily.SetLilySpawner(this); newlily.transform.position = GetLilyOriginPosition(); newlily.SetSpeedVector((Camera.main.transform.position - newlily.transform.position).normalized * 0.01f * LilysSpeed); newlily.gameObject.SetActive(true); }
public void SpawnBug() { BugAI newBug; if (bugsPull.Count <= 0) { newBug = Instantiate(SpawnInfo.GetRandomSpawnable(), transform).GetComponent <BugAI>(); bugsActive.Add(newBug); } else { newBug = bugsPull[0]; bugsActive.Add(newBug); bugsPull.RemoveAt(0); } newBug.SetBugSpawner(this); newBug.transform.position = GetBugOriginPosition(); newBug.SetSpeed((Camera.main.transform.position - newBug.transform.position).normalized * BugsSpeed); newBug.gameObject.SetActive(true); }