public override void UpdateScene(BubbleSystemData data)
 {
     foreach (AbstractBubbleSystemModule module in modules)
     {
         module.UpdateScene(data);
     }
 }
示例#2
0
        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));
                    }
                }
            }
        }
示例#3
0
        void UpdateScene()
        {
            BubbleSystemData first = data.Dequeue();

            manager.UpdateScene(first);
            data.Enqueue(first);
        }
示例#4
0
 public override void UpdateScene(BubbleSystemData data)
 {
     if (data.backgroundData.IsCleared())
     {
         return;
     }
     foreach (Background bg in backgrounds)
     {
         bg.UpdateScene(data);
     }
 }
示例#5
0
        public void HideBalloon(BubbleSystemData data)
        {
            if (control.Show() == ShowResult.FAIL)
            {
                return;
            }
            BalloonsHooks[] balloonHooks = control.Instance.GetComponentsInChildren <BalloonsHooks>();

            foreach (BalloonsHooks hooks in balloonHooks)
            {
                AddCoroutine(Clean(hooks, 0.0f, data));
            }
        }
示例#6
0
 public void UpdateScene(BubbleSystemData data)
 {
     if (!data.tutor.GetString().Equals(_name))
     {
         return;
     }
     bgData.Clear();
     foreach (IEnumerator coroutine in coroutines)
     {
         EffectsManager.Instance.Stop(coroutine);
     }
     StopAllCoroutines();
     StartCoroutine(ChangeImage(data));
 }
示例#7
0
        public override void UpdateScene(BubbleSystemData data)
        {
            if (data.balloonData.IsCleared() && data.balloonData.show == true)
            {
                return;
            }
            if (firstInteraction)
            {
                ReverseTutorsBalloons(data.tutor.GetString());
                firstInteraction = false;
            }

            foreach (Balloon balloon in balloons)
            {
                balloon.UpdateScene(data);
            }
        }
示例#8
0
        private IEnumerator ChangeImage(BubbleSystemData data)
        {
            KeyValuePair <Emotion, float> emotionPair = BubbleSystemUtility.GetHighestEmotion(data.emotions);

            bgData.textureData = DefaultData.Instance.GetDefaultBackgroundDataDictionary(emotionPair.Key.Get(), emotionPair.Value, data.backgroundData.reason);
            float duration = DefaultData.Instance.GetBackgroundDuration();

            bgData.renderer = GetComponent <Renderer>();
            EffectsData <AbstractImageEffect.ImageEffectEnum> effects = data.backgroundData.effects.IsCleared() ? DefaultData.Instance.GetDefaultBackgroundAnimationData(emotionPair.Key.Get(), emotionPair.Value) : data.backgroundData.effects;

            bgData.duration = duration / 2;

            if (!bgData.textureData.name.Equals(bgData.renderer.materials[1].mainTexture.name))
            {
                foreach (AbstractImageEffect.ImageEffectEnum fx in effects.hideEffects.Keys)
                {
                    bgData.curve = effects.hideEffects[fx];
                    coroutines.Add(EffectsManager.Instance.Play(fx, bgData));
                }

                yield return(new WaitForSeconds(bgData.duration));

                bgData.renderer.materials[bgData.renderer.materials.Length - 1].mainTexture          = bgData.textureData;
                bgData.renderer.materials[bgData.renderer.materials.Length - 1].mainTexture.wrapMode = GetWrapMode(data.backgroundData.reason);
            }
            else
            {
                bgData.duration = duration;
            }

            bgData.colorToLerpTo = BubbleSystemUtility.GetColor(emotionPair, data.emotions);

            if (!bgData.renderer.material.color.Equals(bgData.colorToLerpTo))
            {
                foreach (AbstractImageEffect.ImageEffectEnum fx in effects.colorEffects.Keys)
                {
                    bgData.curve = effects.colorEffects[fx];
                    coroutines.Add(EffectsManager.Instance.Play(fx, bgData));
                }

                yield return(new WaitForSeconds(bgData.duration));
            }
        }
示例#9
0
        public override void UpdateScene(BubbleSystemData data)
        {
            if (!data.tutor.GetString().Equals(balloonData._name))
            {
                return;
            }
            foreach (IEnumerator coroutine in coroutines)
            {
                StopCoroutine(coroutine);
            }

            if (data.balloonData.show)
            {
                ShowBalloon(data);
            }
            else
            {
                HideBalloon(data);
            }
        }
示例#10
0
        private void ShowBalloon(BubbleSystemData data)
        {
            if (control.Show() == ShowResult.FAIL)
            {
                return;
            }
            int i = 0;

            BalloonsHooks[] balloonHooks = control.Instance.GetComponentsInChildren <BalloonsHooks>();

            foreach (BalloonsHooks hooks in balloonHooks)
            {
                if (hooks == null)
                {
                    return;
                }

                KeyValuePair <Emotion, float> emotionPair = BubbleSystemUtility.GetHighestEmotion(data.emotions);
                float      sum          = BubbleSystemUtility.GetEmotionsSum(data.emotions);
                SpriteData spriteData   = DefaultData.Instance.GetDefaultBalloonData(emotionPair.Key.Get(), emotionPair.Value);
                Color      color        = BubbleSystemUtility.GetColor(emotionPair, data.emotions);
                float      realDuration = balloonData.options ? DefaultData.Instance.GetOptionsDuration() : DefaultData.Instance.GetBalloonDuration();
                TextData   textData;
                Dictionary <AbstractTextEffect.TextEffectEnum, AnimationCurve> showEffects;
                Color textColor    = BubbleSystemUtility.GetTextColor(color);
                float textDuration = realDuration - durationThreshold; // so it finishes before hide

                balloonData.SetContent(hooks, data.balloonData.text.Count > i ? data.balloonData.text[i] : null);
                balloonData.SetSprites(emotionPair.Key, hooks, spriteData, emotionPair.Value, color, balloonData.options);

                if (i < data.balloonData.callbacks.Count)
                {
                    balloonData.SetCallback(hooks, data.balloonData.callbacks[i], i);
                }

                // Do not animate options
                if (!balloonData.options)
                {
                    if (DefaultData.Instance.blendBalloonAnimation)
                    {
                        balloonData.SetAnimators(hooks, data.emotions);
                    }
                    else
                    {
                        balloonData.SetAnimators(hooks, emotionPair.Key);
                    }

                    textData = DefaultData.Instance.GetDefaultTextData(emotionPair.Key.GetString(), emotionPair.Value);
                    balloonData.SetTexts(hooks, textData, textColor, emotionPair.Key);
                }
                else
                {
                    textData = DefaultData.Instance.GetDefaultTextData(data.tutor.GetString(), emotionPair.Value);
                }

                showEffects = data.balloonData.effects.showEffects.Count != 0 ? data.balloonData.effects.showEffects : textData.showEffect;

                foreach (AbstractTextEffect.TextEffectEnum effect in showEffects.Keys)
                {
                    SetTextEffects(hooks, showEffects[effect], sum, textDuration, true);
                    coroutines.Add(balloonData.SetEffects(effect, textEffectsData));
                }

                hooks.Show();
                if (realDuration != -1)
                {
                    AddCoroutine(Clean(hooks, realDuration, data));
                }
                i++;
            }
        }
 public abstract void UpdateScene(BubbleSystemData data);