private void OnEnable() { age = GetComponent <AgingBehaviour>(); hunger = GetComponent <HungerBehaviour>(); move = GetComponent <MovingBehaviour>(); locator = GetComponent <LocatorBehaviour>(); reproduce = GetComponent <ReproductionBehaviour>(); herbivores = GameObject.FindGameObjectWithTag("HerbivoreContainer").transform; eating = GetComponent <EatingBehaviour>(); carnivores = GameObject.FindGameObjectWithTag("CarnivoreContainer").transform; }
public void TurnIntoZombie() { if (isZombie) { return; } isZombie = true; tag = "Zombie"; if (DiseaseEffect != null) { Destroy(DiseaseEffect); } HerbivoreBehaviour herbivore = GetComponent <HerbivoreBehaviour>(); if (herbivore != null) { Destroy(herbivore); } age = GetComponent <AgingBehaviour>(); if (age != null) { Destroy(age); } hunger = GetComponent <HungerBehaviour>(); hunger.HungerDamage = 0; reproduce = GetComponent <ReproductionBehaviour>(); if (reproduce != null) { Destroy(reproduce); } locator = GetComponent <LocatorBehaviour>(); eating = GetComponent <EatingBehaviour>(); carnivores = GameObject.FindGameObjectWithTag("CarnivoreContainer").transform; move = GetComponent <MovingBehaviour>(); move.Speed = ZombieSpeed; move.Flee = false; transform.parent = GameObject.FindGameObjectWithTag("ZombieContainer").transform; GetComponent <Animator>().runtimeAnimatorController = Resources.Load <RuntimeAnimatorController>("Animations/Zombie/ZombieSheet_0"); }
private void OnEnable() { hunger = GetComponent <HungerBehaviour>(); animator = GetComponent <Animator>(); }