Example #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;
 }
Example #2
0
        public override void InitializeAgent()
        {
            base.InitializeAgent();
            perception         = GetComponent <RayPerception>();
            behaviorParameters = GetComponent <BehaviorParameters>();
            parentTransform    = transform.parent;
            parentBody         = GetComponentInParent <Rigidbody>();
            totalFoodEaten     = 0;

            movement = GetComponent <MovementBehaviour>();
            eating   = GetComponent <EatingBehaviour>();
        }
Example #3
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");
    }
Example #4
0
 /// <summary>
 /// Initializes the a new instance of the <see cref="Animal"/> struct.
 /// </summary>
 /// <param name="size">The size of the animal.</param>
 /// <param name="eatingBehaviour">The eating behaviour of the animal.</param>
 public Animal(Size size, EatingBehaviour eatingBehaviour)
 {
     Size            = size;
     EatingBehaviour = eatingBehaviour;
 }