Ejemplo n.º 1
0
        void Start()
        {
            anim = GetComponent <Animator>();

            if (Dragon)
            {
                if (!Dragon.activeInHierarchy)
                {
                    Dragon = Instantiate(Dragon);
                }

                animal = Dragon.GetComponent <MAnimal>();

                animal.transform.position = transform.position;
                animal.Anim.Play("Hatch");                                       //Set the egg State (This set on the animator INT -10 which is the transition for the EggHatching Start Animation
                animal.LockInput    = true;
                animal.LockMovement = true;
                //animal.enabled = false;

                animal.transform.localPosition += preHatchOffset;
                animal.GetComponentInChildren <SkinnedMeshRenderer>().enabled = false;
            }


            if (hatchtype == HatchType.Time)
            {
                StartCoroutine(TimeCrackEgg());
            }
        }
Ejemplo n.º 2
0
        public void CrackEgg()
        {
            anim.SetInteger("State", 1);
            if (animal)
            {
                animal.GetComponentInChildren <SkinnedMeshRenderer>().enabled = true;

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

            OnEggCrack.Invoke();

            StartCoroutine(EggDisapear(removeShells));

            Invoke("EnableAnimalScript", 0.1f);
        }