private IEnumerator BonusGeneratorCoroutine() { while (true) { for (int i = m_Settings.BonusCountPerTick - 1; i >= 0; i--) { Bonus bonus = BonusPool.Instance.GetItem() as Bonus; bonus.transform.position = new Vector3( Cam.transform.position.x + Random.Range(1f, 3f) * (Random.Range(0, 1) > 0 ? 1 : -1), Cam.transform.position.y + Random.Range(1f, 5f) * (Random.Range(0, 1) > 0 ? 1 : -1), 0); bonus.gameObject.SetActive(true); bonus.Set(BonusType.GetRandom()); } yield return(new WaitForSeconds(m_Settings.SpawnBonusesDelay)); } }
public void Set(BonusType type) { Type = type; }