Exemplo n.º 1
0
    public void Play(float duration, System.Action MidWayAction, System.Action EndAction = null)
    {
        image.enabled = true;
        transform.SetSiblingIndex(transform.parent.childCount - 1);
        bool midwayReached = false;

        this.ProgressionAnim(duration, delegate(float progression)
        {
            image.color = image.color.SetA(AniMath.Bell(progression));
            if (progression >= .5f && !midwayReached)
            {
                if (MidWayAction != null)
                {
                    MidWayAction();
                }
                midwayReached = true;
            }
        }, delegate
        {
            if (EndAction != null)
            {
                EndAction();
            }
            image.enabled = false;
        });
    }
Exemplo n.º 2
0
    public void CutAudio()
    {
        float volumeBeforeEnding = audio.volume;

        this.ProgressionAnim(3, (progression) =>
        {
            audio.volume = Mathf.Lerp(volumeBeforeEnding, 0, AniMath.Smooth(progression));
        });
    }
Exemplo n.º 3
0
 void Flash()
 {
     if (!gameObject.activeInHierarchy)
     {
         return;
     }
     this.ProgressionAnim(flashDuration, progression =>
     {
         HandleProgression(AniMath.Bell(progression));
     }, OnFlashEnd);
 }
Exemplo n.º 4
0
 void Start()
 {
     // Lower the audio after some time in the scene.
     this.Timer(lowerDelay, () =>
     {
         this.ProgressionAnim(3, (progression) =>
         {
             audio.volume = Mathf.Lerp(defaultVolume, lowVolume, AniMath.Smooth(progression));
         });
     });
 }
Exemplo n.º 5
0
 public static void Flash(this Text text, MonoBehaviour caller, Color color, float duration = 1.5f, float delay = 0)
 {
     // Hide the text after some time.
     text.color = color;
     caller.Timer(delay, () =>
                  caller.ProgressionAnim(duration, (progression) =>
                                         text.color = Color.Lerp(color, Color.clear, AniMath.SmoothStart(progression))
                                         ));
 }