Esempio n. 1
0
        private IEnumerator AddHeartWithAnimCoroutine()
        {
            HeartView heart = Instantiate(_heartViewPrefab, transform);

            hearts.Add(heart);
            heart.Animator.SetTrigger(AnimatorResources.CreateHeartTriggerId);
            yield break;
        }
Esempio n. 2
0
        private IEnumerator RemoveHeartWithAnimCoroutine()
        {
            if (hearts.Count > 0)
            {
                HeartView heart = hearts[0];
                hearts.RemoveAt(0);

                heart.Animator.SetTrigger(AnimatorResources.DeleteHeartTriggerId);

                float animLength = heart.Animator.runtimeAnimatorController.animationClips[0].length;

                yield return(new WaitForSeconds(animLength));

                Destroy(heart.gameObject);
            }
        }