Skip to main content

BlinkingController

A class in Root.Township, Alta.Character.

Makes a character's eyes blink at random intervals by firing left and right eye triggers on an Animator. Client only: it does nothing on a headless server.

Constructors​

MemberWhat it is
BlinkingController()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

8 private and internal fields
MemberWhat it is
private Animator animatorThe Animator that has the eye blink triggers and speed parameters.
private float blinkDurationHow long one blink takes, in seconds. Default 0.1.
private float doubleBlinkPercentageChance (0 to 1) that a blink is followed by a second one.
private BlinkingController.EyeBlinker leftBlinkerWrapper that fires the left eye's blink trigger.
private float maxTimeLongest wait between blinks, in seconds. Default 5.
private float minTimeShortest wait between blinks, in seconds. Default 2.
private BlinkingController.EyeBlinker rightBlinkerWrapper that fires the right eye's blink trigger.
private float timeBetweenDoubleBlinkWait between the two blinks of a double blink, in seconds. Default 0.3.

Methods​

MemberWhat it is
void Blink()Blinks both eyes once by setting the LeftEyeBlink and RightEyeBlink triggers.
void StartBlinking()Starts the random blink coroutine. Does nothing when headless.
void StopBlinking()Stops all coroutines on this component, which ends the blinking. Does nothing when headless.
4 private and internal methods
MemberWhat it is
private void Awake()Sets up the left and right eye blinkers on the animator, with a blink speed of one over blinkDuration. Skipped when headless.
private IEnumerator BlinkInSeconds() (iterator)Coroutine that loops forever: waits a random time between minTime and maxTime, blinks, and sometimes blinks again.
private void OnDisable()Stops blinking.
private void OnEnable()Starts blinking.