Exemple #1
0
 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));
     }
 }
Exemple #2
0
 public void Set(BonusType type)
 {
     Type = type;
 }