private IEnumerator Destroy() { destroyed = true; var trail = GetComponentInChildren <TrailRenderer>(); trail.transform.parent = null; var rigidbodies = GetComponentsInChildren <Rigidbody>(); foreach (var rigidbody in rigidbodies) { Destroy(rigidbody); } yield return(new WaitForSeconds(1)); spawnScript.Spawn(); catapultController.cameraPause = false; catapultController.waitingForArrival = false; GameObject.Destroy(gameObject.transform.parent.gameObject); yield return(new WaitForSeconds(5)); Destroy(this.gameObject.transform.parent.gameObject); }
private void Update() { timer += Time.deltaTime; if (timer >= currSpawnTime) { currSpawnTime = URand.Range(minSpawnTime, maxSpawnTime); timer = 0; spawnScript.Spawn(); } }
public void Fire() { if (canFire) { canFire = false; bulletSpawnScript.Spawn(); animControll.SetTrigger(fireTriggerHash); if (audioSource.enabled) { audioSource.PlayOneShot(audioSource.clip); } } }