ColorFlash

ColorFlash#

NAMESPACE:

UnityUtils.ScriptUtils.Objects.ColorFlash

A class that hold some parameters for Color flashes, used in ColorFlashManager

Example Usage#

 using UnityEngine;
 using UnityUtils.ScriptUtils.Objects;

 public class ExampleScript : MonoBehaviour
 {
      public ColorFlash flash = ColorFlash.CreateDefaultFlash();
      public ColorFlashManager flashManager;

      void Start()
      {
         // Flash the object with a ColorFlashManager applied using the "flash"
         flashManager.Flash(flash);
      }
}

Functions#

UnityUtils.ScriptUtils.Objects.ColorFlash.ColorFlash

Public Functions

ColorFlash SetFadeIn(float fadeInTime, AnimationCurve fadeInCurve)#

Sets the fadeInTimeSeconds and fadeInCurve properties.

ColorFlash SetFadeOut(float fadeOutTime, AnimationCurve fadeOutCurve)#

Sets the fadeOutTimeSeconds and fadeOutCurve properties.

Public Members

Color color = Color.white#

The Color that is flashed to.

float durationSeconds = 0.1f#

The amount of time, in seconds, that the flash is at flashAmount for after fade in and before fade out.

AnimationCurve fadeInCurve = AnimationCurve.Linear(0, 0, 1, 1)#

The animation curve that controls the fade in of the flash.

float fadeInTimeSeconds = 0#

The amount of time, in seconds, that the flash takes to fade in from 0 intensity to flashAmount at the start of the flash.

AnimationCurve fadeOutCurve = AnimationCurve.Linear(0, 0, 1, 1)#

The animation curve that controls the fade out of the flash.

float fadeOutTimeSeconds = 0#

The amount of time, in seconds, that the flash takes to fade out from flashAmount to 0 intensity at the end of the flash.

float flashAmount = 1#

A 0 to 1 range of the intensity of the flash. 0 means no flash, and 1 means full flash.

bool useRealtime = false#

if True, will use unscaled time instead of scaled time for the flash duration and fade in/out times.

Public Static Functions

ColorFlash CreateDefaultFlash()#

Creates a default color flash with the following properties:

- color: Color.white

- durationSeconds: 0.1s

- fadeInCurve: AnimationCurve.Linear(float, float, float, float) from 0 to 1

- fadeInTimeSeconds: 0s

- fadeOutCurve: AnimationCurve.Linear(float, float, float, float) from 0 to 1

- fadeOutTimeSeconds: 0s

- flashAmount: 1

- useRealtime: false

ColorFlash CreateDefaultFadeOutFlash()#

Creates a default color flash with the following properties:

- color: Color.white

- durationSeconds: 0s

- fadeInCurve: AnimationCurve.Linear(float, float, float, float) from 0 to 1

- fadeInTimeSeconds: 0s

- fadeOutCurve: AnimationCurve.Linear(float, float, float, float) from 0 to 1

- fadeOutTimeSeconds: 0.25s

- flashAmount: 1

- useRealtime: false