Example #1
0
        public void CrackEgg()
        {
            var col = GetComponent <Collider>();

            anim.SetInteger("State", 1); //Crak the Egg Animation
            if (col)
            {
                Destroy(col);
            }

            if (animal)
            {
                animal.State_Force(StateEnum.Idle);

                var skinnedMeshes = animal.GetComponentsInChildren <Renderer>();
                foreach (var item in skinnedMeshes)
                {
                    item.enabled = true;
                }

                animal.SetIntID(Random.Range(1, 4)); //Set a random Out of the Egg animation
            }

            OnEggCrack.Invoke();

            StartCoroutine(EggDisapear(removeShells));
        }
Example #2
0
        /// <summary>Enables the Zone using the State</summary>
        private void ActivateStateZone()
        {
            switch (stateAction)
            {
            case StateAction.Activate:
                CurrentAnimal.State_Activate(stateID);
                break;

            case StateAction.AllowExit:
                if (CurrentAnimal.ActiveStateID == stateID)
                {
                    CurrentAnimal.ActiveState.AllowExit();
                }
                break;

            case StateAction.ForceActivate:
                CurrentAnimal.State_Force(stateID);
                break;

            case StateAction.Enable:
                CurrentAnimal.State_Enable(stateID);
                break;

            case StateAction.Disable:
                CurrentAnimal.State_Disable(stateID);
                break;

            default:
                break;
            }

            StatModifier.ModifyStat(AnimalStats);
            AlignAnimal();
            OnZoneActivation.Invoke();
        }