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); } }
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; } } }
private void Awake() { _rb = GetComponentInParent <Rigidbody>(); _copAI = GetComponentInParent <CopAI>(); }