Esempio n. 1
0
 public void CreateAllCars()
 {
     for (int i = 0; i < copInitialQuantity; i++)
     {
         GameObject police = GameObject.Instantiate(this.cop, this.transform);
         CopAI      cop    = police.GetComponent <CopAI>();
         cop.copPool = this;
         police.SetActive(false);
         this.copCars.Push(police);
     }
 }
Esempio n. 2
0
 public void CreateCop()
 {
     if (_copPool.HasCops())
     {
         int        randomPos = Random.Range(0, copSpawnPoints.Length);
         GameObject police    = _copPool.CreateCop();
         CopAI      cop       = police.GetComponent <CopAI>();
         police.transform.position = copSpawnPoints[randomPos].transform.position;
         police.SetActive(true);
         if (spawnTime >= 0.5f)
         {
             spawnTime -= 0.05f;
         }
     }
 }
Esempio n. 3
0
 private void Awake()
 {
     _rb    = GetComponentInParent <Rigidbody>();
     _copAI = GetComponentInParent <CopAI>();
 }