Esempio n. 1
0
        /// <summary>Enables the Zone using the Stance</summary>
        private void ActivateStanceZone()
        {
            // CurrentAnimal.Mode_Interrupt(); //in case the Animal is doing a mode Interrupt it

            switch (stanceAction)
            {
            case StanceAction.Enter:
                CurrentAnimal.Stance_Set(stanceID);
                break;

            case StanceAction.Exit:
                CurrentAnimal.Stance_Reset();
                break;

            case StanceAction.Toggle:
                CurrentAnimal.Stance_Toggle(stanceID);
                break;

            case StanceAction.Stay:
                CurrentAnimal.Stance_Set(stanceID);
                break;

            default:
                break;
            }

            StatModifierOnActive.ModifyStat(AnimalStats);
            OnZoneActivation.Invoke(CurrentAnimal);
        }
Esempio n. 2
0
        void OnTriggerExit(Collider other)
        {
            if (other.isTrigger)
            {
                return;
            }
            if (HeadOnly && !other.name.Contains(HeadName))
            {
                return;                                                     //if is only set to head and there's no head SKIP
            }
            MAnimal existing_animal = other.GetComponentInParent <MAnimal>();

            if (!existing_animal)
            {
                return;                                                              //If there's no animal script found skip all
            }
            if (existing_animal != CurrentAnimal)
            {
                return;                                                             //If is another animal exiting the zone SKIP
            }
            if (animal_Colliders.Find(item => item == other))                       //Remove the collider from the list that is exiting the zone.
            {
                animal_Colliders.Remove(other);
            }

            if (animal_Colliders.Count == 0)                                       //When all the collides are removed from the list..
            {
                OnExit.Invoke(CurrentAnimal);                                      //Invoke On Exit when all animal's colliders has exited the Zone
                StatModifierOnExit.ModifyStat(AnimalStats);                        //Modify the stats when exit

                if (zoneType == ZoneType.Stance && stanceAction == StanceAction.Stay && CurrentAnimal.Stance == stanceID.ID)
                {
                    CurrentAnimal.Stance_Reset();
                }

                ResetStoredAnimal();
            }
        }