public void SetAnimators(BalloonsHooks hooks, Dictionary <Emotion, float> emotions) { Animator animator = hooks.GetComponent <Animator>(); if (!(animator && animator.isActiveAndEnabled)) { return; } float sum = 0; ResetAllFloats(animator); foreach (Emotion emotion in emotions.Keys) { if (emotion.Get().Equals(Emotion.EmotionEnum.Neutral)) { continue; } sum += emotions[emotion]; animator.SetFloat(emotion.GetString(), emotions[emotion]); } animator.SetFloat(Emotion.EmotionEnum.Neutral.ToString(), 1.0f - sum); animator.SetFloat(DefaultData.Instance.Default, 1.0f); }
IEnumerator Clean(BalloonsHooks hooks, float duration, BubbleSystemData data) { yield return(new WaitForSeconds(duration)); if (hooks) { if (hooks.Content != null) { hooks.Hide(); var animationClips = hooks.GetComponent <Animator>().runtimeAnimatorController.animationClips; float length = balloonData.GetClipsDuration(hooks) * 2; //times 2, to give it a little more time KeyValuePair <Emotion, float> emotionPair = BubbleSystemUtility.GetHighestEmotion(data.emotions); float sum = BubbleSystemUtility.GetEmotionsSum(data.emotions); TextData textData; if (balloonData.options) { textData = DefaultData.Instance.GetDefaultTextData(data.tutor.GetString(), emotionPair.Value); } else { textData = DefaultData.Instance.GetDefaultTextData(emotionPair.Key.GetString(), emotionPair.Value); } Dictionary <AbstractTextEffect.TextEffectEnum, AnimationCurve> hideEffects = data.balloonData.effects.hideEffects.Count != 0 ? data.balloonData.effects.hideEffects : textData.hideEffect; foreach (AbstractTextEffect.TextEffectEnum effect in hideEffects.Keys) { SetTextEffects(hooks, hideEffects[effect], sum, length, false); coroutines.Add(balloonData.SetEffects(effect, textEffectsData)); } } } }
public void SetAnimators(BalloonsHooks hooks, Emotion emotion) { Animator animator = hooks.GetComponent <Animator>(); if (!(animator && animator.isActiveAndEnabled)) { return; } ResetAllFloats(animator); animator.SetFloat(emotion.GetString(), 1.0f); animator.SetFloat(DefaultData.Instance.Default, 1.0f); }