Exemplo n.º 1
0
 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;
 }
Exemplo n.º 2
0
    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");
    }
Exemplo n.º 3
0
    private void OnEnable()
    {
        reproduction = GetComponent <ReproductionBehaviour>();

        InvokeRepeating("ReproduceRandomly", 0.5f, 0.5f + Random.Range(0f, 0.15f));
    }