public TagChaserMove Infect() { TagChaserMove zombie = Instantiate(zombiePrefab, transform.position, transform.rotation, transform.parent).GetComponent <TagChaserMove>(); transform.GetChild(transform.childCount - 1).SetParent(zombie.transform); Destroy(this.gameObject); return(zombie); }
IEnumerator ZombieToChaser(TagChaserMove next) { Instantiate(infectParticlePrefab, next.transform.position, Quaternion.Euler(-90, 0, 0), next.transform); yield return(new WaitForSeconds(1.7f)); chaser.Add(Instantiate(chaser[0], next.transform.position, next.transform.rotation, transform).GetComponent <TagChaserMove>()); next.transform.GetChild(next.transform.childCount - 1).SetParent(chaser[chaser.Count - 1].transform); Destroy(next.gameObject); }
public bool ZombieToChaser() { if (zombies.Count <= 0) { return(false); } TagChaserMove next = zombies[Random.Range(0, zombies.Count - 1)]; zombies.Remove(next); StartCoroutine(ZombieToChaser(next)); return(true); }