void Start() { poolAbleObject = GameObject.FindGameObjectWithTag("GameManager").GetComponent <PoolAbleObject>(); #region xSpawnPoints //did it manually for spawner points xSpawnPositions[0] = 6.4f; xSpawnPositions[1] = 4.7f; xSpawnPositions[2] = 3.2f; xSpawnPositions[3] = 1.5f; xSpawnPositions[4] = 0; xSpawnPositions[5] = -1.6f; #endregion for (int i = 0; i < cars.Length; i++) { GameObject car = Instantiate(cars[i], spawnPoint, Quaternion.LookRotation(Vector3.back)); poolAbleObject.AddCarTheList(car); car.SetActive(false); SpawnCarConfigure(car); } StartCoroutine(CarWave()); }
private void OnTriggerEnter(Collider Touch) { if (Touch.CompareTag("EnemyCar") || Touch.CompareTag("Bomb")) { GameObject particle = Instantiate(ExplosionParticleEffect, transform.position, Quaternion.identity); Destroy(particle, 0.75f); if (Touch.CompareTag("EnemyCar")) { poolAbleObject.AddCarTheList(Touch.gameObject); } Touch.gameObject.SetActive(false); this.gameObject.SetActive(false); } }
void PoolTheObject() { poolAbleObject.AddCarTheList(this.gameObject); }