예제 #1
0
 // Get a positive or negative number and adjust the number of active bugs in the pool
 private void GetNewBugFromPool(BugGender g)
 {
     for (int i = 0; i < bugsPool.Count; i++)
     {
         if (!bugsPool[i].activeSelf)
         {
             bugsPool [i].GetComponent <Bug> ().Initialize(g);
             return;
         }
     }
     Debug.Log("Pool is at maximum");
 }
예제 #2
0
 /// <summary>
 /// Initialize a new bug with the specified Gender.
 /// </summary>
 /// <param name="g">The bug's Gender.</param>
 public void Initialize(BugGender g)
 {
     gameObject.SetActive(true);
     Gender = g;
     Debug.Log(Gender);
     status             = Status.Adult;
     birthTime          = Time.time;
     transform.position = Utilities.randomVectorInRange(50);
     transform.rotation = Quaternion.LookRotation(Utilities.randomVectorInRange(1));
     count [(int)Gender]++;
     StartCoroutine(CheckIfDead());
     Debug.Log(string.Format("FROM BUG : {0} has been enabled, Active count now {1}", this.name, CountActive));
 }