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; }); }
public void CutAudio() { float volumeBeforeEnding = audio.volume; this.ProgressionAnim(3, (progression) => { audio.volume = Mathf.Lerp(volumeBeforeEnding, 0, AniMath.Smooth(progression)); }); }
void Flash() { if (!gameObject.activeInHierarchy) { return; } this.ProgressionAnim(flashDuration, progression => { HandleProgression(AniMath.Bell(progression)); }, OnFlashEnd); }
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)); }); }); }
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)) )); }