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;
                var skinnedMeshes = animal.GetComponentsInChildren <Renderer>();

                foreach (var item in skinnedMeshes)
                {
                    item.enabled = false;
                }
            }


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

            Invoke("EnableAnimalScript", 0.1f);
        }