示例#1
0
 private void FadeOutIn()
 {
     m_FadeTweening = new Tweening((a, b, x) => 1.0f - (float)Math.Pow(Math.Sin(Math.PI * x), 4.0));
 }
示例#2
0
        private void SetupDrawing()
        {
            var g = Game.Inst.Graphics;

            var defMaterial = new AdsMaterial {
                Ambient = new Vector4(0.1f, 0.1f, 0.1f, 1.0f)
            };

            Pong.PsAfterimage.SetTextures(Pong.RenderTargets[0], Pong.RenderTargets[2]);
            Pong.PsBlend.SetTextures(g.TextureMgr.White, Pong.RenderTargets[0]);
            Pong.PsChromaticAberration.SetTextures(Pong.RenderTargets[0]);
            Pong.PsMotionBlur1.SetTextures(Pong.RenderTargets[0], Pong.RenderTargets[1]);
            Pong.PsNoise.SetTextures(Pong.RenderTargets[2]);
            Pong.PsSoft.SetTextures(Pong.RenderTargets[0]);

            Pong.PsAdsMaterial.SetConstants(defMaterial);
            Pong.PsAfterimage.SetConstants(Pong.AfterimageConstants(0.45f, 1));
            Pong.PsChromaticAberration.SetConstants(0.85f);

            Pong.RenderTargets[2].Clear(new Color(1.0f, 1.0f, 1.0f, 1.0f));

            var defDrawFunc = m_GraphicsSubsystem.DrawFunc;

            Action drawMotionBlur = () => {
                g.RenderTarget = Pong.RenderTargets[1];
                g.PixelShader  = Pong.PsMotionBlur0;
                g.VertexShader = Pong.VsMotionBlur;

                g.RenderTarget.Clear(Color.Black);

                var entities = Game.Inst.Scene.GetEntities <MotionBlurComponent>();
                foreach (var entity in entities)
                {
                    var motionBlur = entity.GetComponent <MotionBlurComponent>();
                    var triMesh    = entity.GetComponent <TriMeshComponent>();
                    var transform  = m_GraphicsSubsystem.CalcTransform(entity);

                    transform.Transpose();

                    if (motionBlur.PrevTransform.M11 == 0.0f)
                    {
                        motionBlur.PrevTransform = transform;
                    }

                    Pong.VsMotionBlur.SetConstants(motionBlur.PrevTransform);
                    g.DrawTriMesh(triMesh.TriMesh, transform);
                    motionBlur.PrevTransform = transform;
                }

                g.ApplyPostFX(Pong.RenderTargets[0], Pong.PsMotionBlur1);
            };

            m_GraphicsSubsystem.DrawFunc = () => {
                Pong.PsNoise.SetConstants(Pong.Rnd(1, 999));

                g.RenderTarget = Pong.RenderTargets[0];
                g.PixelShader  = Pong.PsAdsMaterial;
                g.VertexShader = g.DefaultVertexShader;

                defDrawFunc();

                g.ApplyPostFX(Pong.RenderTargets[0], Pong.PsChromaticAberration);
                g.ApplyPostFX(Pong.RenderTargets[0], Pong.PsSoft);

                drawMotionBlur();

                if (m_FadeTweening != null)
                {
                    Pong.PsBlend.SetConstants(m_FadeTweening.Calc());
                    g.ApplyPostFX(Pong.RenderTargets[0], Pong.PsBlend);

                    if (m_FadeTweening.IsDone)
                    {
                        m_FadeTweening = null;
                    }
                }

                g.ApplyPostFX(Pong.RenderTargets[2], Pong.PsAfterimage);
                g.ApplyPostFX(g.ScreenRenderTarget, Pong.PsNoise);
            };
        }
示例#3
0
 public void DisplayButton()
 {
     StartCoroutine(Tweening.ScaleTab(buttonPanel.gameObject, buttonPanel.localScale.x, hasUIScaled ? 0 : 1, GV.shortAnimationTime));
     hasUIScaled = !hasUIScaled;
 }
示例#4
0
 /// <summary>
 /// Interpolates between two values.
 /// </summary>
 /// <param name="value1">The first value to interpolate.</param>
 /// <param name="value2">The second value to interpolate.</param>
 /// <param name="easing">The easing function.</param>
 /// <param name="factor">The interpolation factor.</param>
 /// <returns>The interpolated value.</returns>
 public T InterpolateValues(T value1, T value2, EasingFunction easing, Single factor)
 {
     return(Tweening.Tween(value1, value2, easing, factor));
 }
 public void Animate()
 {
     startPos = damagePrefab.transform.position;
     StartCoroutine(Tweening.FadeTextOpacity(damageText, damageText.alpha, 0, GV.fadeAnimationTime));
     StartCoroutine(Tweening.MoveTab(damagePrefab, false, damagePrefab.transform.position.y, startPos.y - distanceToTravel, GV.moveAnimationTime));
 }
示例#6
0
 private void Start()
 {
     controller = GetComponent <CharacterController>();
     tween      = FindObjectOfType <Tweening>();
     ColorCha   = FindObjectOfType <ColorChanger>();
 }
示例#7
0
 public void OnPointerUp(PointerEventData eventData)
 {
     AudioManager.Instance.InitializeRoutingAndPlay(AudioManager.Instance.genericClips, GV.channelID_ui, 1, GV.uiFX, false);
     Tweening.ButtonFocusReset(gameObject);
 }