Exemplo n.º 1
0
        private IEnumerator TurnOffAnimation(Transform t, AnimationPlay play)
        {
            var animator = t.GetComponent <Animator>();

            while (!animator.GetCurrentAnimatorStateInfo(0).IsName("End"))
            {
                yield return(new WaitForSeconds(1.3f));
            }
            if (UI.EntryMode.GetAssembleModel() == AssembleModel.StudyModel)
            {
                Manager.AssembleManager.Instance.Recovery();
            }
            t.gameObject.SetActive(false);

            play.SetIsDone();
        }
Exemplo n.º 2
0
        /// <summary>
        /// This function will invoke a animation to play in the specific position and rotation
        /// </summary>
        /// <param name="name">The name of the animation, which is the name of the gameObject of the child of AnimationCollection</param>
        /// <param name="target">The position and rotation where the animation will happen</param>
        public AnimationPlay PlayAnimation(string name, Transform target)
        {
            var       play = new AnimationPlay();
            Transform animationTransform;

            if (animationList.TryGetValue(name, out animationTransform))
            {
                animationTransform.position = target.position;
                animationTransform.rotation = target.rotation;
                animationTransform.gameObject.SetActive(true);
                StartCoroutine(TurnOffAnimation(animationTransform, play));
            }
            else
            {
                Debug.Log("Not about to find the animation of name " + name);
                play.SetIsDone();
            }
            return(play);
        }