예제 #1
0
        public void OnActivate()
        {
            if (Warnings.Inactive(this))
            {
                return;
            }

            var glider = GameObj.GetComponent <AlphaGlider>();

            if (!Warnings.NullOrDisposed(glider))
            {
                glider?.Add(new AlphaGlider.Step
                {
                    Duration = EffectSpeed,
                    Patient  = false,
                    Target   = NormalAlpha
                });

                glider?.Add(new AlphaGlider.Step
                {
                    Duration = EffectSpeed,
                    Patient  = true,
                    Target   = 0,
                    Text     = true
                });
            }

            if (_transferMessages != null && _transferMessages.ContainsKey(Channel))
            {
                Flash(_transferMessages[Channel]);
                _transferMessages.Remove(Channel);
            }
        }
예제 #2
0
        public void Flash(Notification message)
        {
            if (string.IsNullOrWhiteSpace(message.Text))
            {
                return;
            }
            if (Warnings.Inactive(this))
            {
                return;
            }

            var renderer = GameObj.GetComponent <TextRenderer>();

            if (Warnings.NullOrDisposed(renderer))
            {
                return;
            }

            _lastMessage     = message;
            _lastMessageTime = Time.GameTimer.TotalSeconds;

            var source = message.Text;

            renderer.Text.ApplySource(source);

            var bg = GameObj.GetComponent <Background>();

            if (!Warnings.NullOrDisposed(bg))
            {
                bg.PerformLayout();
            }

            var bgRenderer = GameObj.GetComponent <SpriteRenderer>();

            if (!Warnings.NullOrDisposed(bgRenderer))
            {
                bgRenderer.ColorTint = message.Color.WithAlpha(NormalAlpha);
            }

            var glider = GameObj.GetComponent <AlphaGlider>();

            if (Warnings.NullOrDisposed(glider))
            {
                return;
            }

            glider.Add(new AlphaGlider.Step
            {
                Duration = EffectSpeed / 6,
                Patient  = false,
                Target   = 1,
                Text     = true
            });

            glider.Add(new AlphaGlider.Step
            {
                Duration = EffectSpeed,
                Patient  = true,
                Target   = FlashAlpha
            });

            glider.Add(new AlphaGlider.Step
            {
                Duration = EffectSpeed,
                Patient  = true,
                Target   = ActiveAlpha
            });

            glider.Add(new AlphaGlider.Step
            {
                Duration = message.Duration,
                Finite   = message.Finite,
                Patient  = true,
                Target   = ActiveAlpha
            });

            glider.Add(new AlphaGlider.Step
            {
                Duration = EffectSpeed,
                Patient  = true,
                Target   = NormalAlpha
            });

            glider.Add(new AlphaGlider.Step
            {
                Duration = EffectSpeed / 3,
                Patient  = true,
                Target   = 0,
                Text     = true
            });
        }