GenericCountDown
Jump To Parameters
Jump To Function Definitions
Parameter Definitions
Select the parameter name from below to jump directly to it on this page.
OnNumberChange
OnStartCounting
OnStopCounting
OnZero
countSpeed
debugging
ifIsOwner
numberType
soundSource
startTime
startType
syncWithPhotonServer
texts
tickClip
useRoomOwnerShip
OnNumberChange
UnityEvent. Called when the current number the counter is at changes.
| Exposed Value | Type | Default Value |
|---|---|---|
| public | FloatUnityEvent | new FloatUnityEvent() |
OnStartCounting
UnityEvent. Called when the counting starts.
| Exposed Value | Type | Default Value |
|---|---|---|
| public | UnityEvent | new UnityEvent() |
OnStopCounting
UnityEvent. Called when the countind stops.
| Exposed Value | Type | Default Value |
|---|---|---|
| public | UnityEvent | new UnityEvent() |
OnZero
UnityEvent. Called when the current number reaches zero.
| Exposed Value | Type | Default Value |
|---|---|---|
| public | UnityEvent | new UnityEvent() |
countSpeed
How fast to count down? Higher = faster, Lower = Slower
| Exposed Value | Type | Default Value |
|---|---|---|
| protected | float | 1.0f |
debugging
If you want verbose logging into the console as to what is happening in this script.
| Exposed Value | Type | Default Value |
|---|---|---|
| protected | bool | false |
ifIsOwner
If you are the owner then only perform the OnZero event.
| Exposed Value | Type | Default Value |
|---|---|---|
| protected | bool | false |
numberType
How do you want the number to be displayed? \n”
WholeNumber = Display in integer format\n\n”
FullTime = Display like 00:00:00\n\n”
AbbreviatedTime = Display like 00:00\n\n”
Raw = Display the raw float value
| Exposed Value | Type | Default Value |
|---|---|---|
| protected | NumberType | NumberType.WholeNumber |
soundSource
(Optional) The audio source to play the tick clip sound.
| Exposed Value | Type | Default Value |
|---|---|---|
| protected | AudioSource | null |
startTime
The time the timer will start counting down from.
| Exposed Value | Type | Default Value |
|---|---|---|
| protected | float | 6.0f |
startType
When do you want to start counting?\n”
Immediately=The OnStart call will trigger the counting sequence.\n”
OnCall=An outside source will have to call the StartCounting function.
| Exposed Value | Type | Default Value |
|---|---|---|
| protected | CounterStartType | CounterStartType.OnCall |
syncWithPhotonServer
If you want to countdown based off the time on the photon server. Great for “
having everyone keep the same time. However this is not responsible for starting “
everyone at the same time. Just counting down at the same speed!
| Exposed Value | Type | Default Value |
|---|---|---|
| protected | bool | false |
texts
(Optional)Texts to overwrite and show the current counted number.
| Exposed Value | Type | Default Value |
|---|---|---|
| protected | Text[] | new Text[] { } |
tickClip
(Optional) The audio clip to play every time a whole number goes down by 1.
| Exposed Value | Type | Default Value |
|---|---|---|
| protected | AudioClip | null |
useRoomOwnerShip
Only perform the UnityEvents if you are the owner/not the owner.
| Exposed Value | Type | Default Value |
|---|---|---|
| protected | bool | false |
Function Definitions
Select the function name from below to jump directly to it on this page.
OnRoomPropertiesUpdate
PlayAudioClip
RemoveRoomProperties
SetAudioSource
SetClip
SetStartTime
SetTexts
SetTime
Start
StartCounting
StopCounting
SubtractTime
TimerEnded
Update
protected virtual void OnRoomPropertiesUpdate(Hashtable propertiesThatChanged)
Callback method. This is called when the properties of the current room have changed. Will start the timer and set the sync values based on what is received.
| Expose Value | Overrideable | Returns |
|---|---|---|
| protected | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| propertiesThatChanged | *No found decription |
protected virtual void PlayAudioClip()
Start playing the
soundSource.
| Expose Value | Overrideable | Returns |
|---|---|---|
| protected | True | Does not return anything |
No parameters
public virtual void RemoveRoomProperties()
Removes all the custom room properties that this component has added to sync the times.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
No parameters
public virtual void SetAudioSource(AudioSource source)
Sets the
soundSource.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| source | AudioSource type, the audiosource to use. |
public virtual void SetClip(AudioClip clip)
Sets the
tickClip.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| clip | AudioClip type, the tick clip to use. |
public virtual void SetStartTime(float timeToStart)
The time that the timer should start at when first starting to count down.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| timeToStart | float type, the start counting from time. |
protected virtual void SetTexts(string value)
Set the
textsvalues to be whatever the input string is.
| Expose Value | Overrideable | Returns |
|---|---|---|
| protected | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| value | string type, the string to display |
public virtual void SetTime(float incomingTime)
Set the current time number the counter is at.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| incomingTime | float type, the current time number to set. |
protected virtual void Start()
If the
startTypeisImmediatelyit will call theStartCountingfunction. Also sets thetickClipif there is asoundSourceand atickClipspecified.
| Expose Value | Overrideable | Returns |
|---|---|---|
| protected | True | Does not return anything |
No parameters
public virtual void StartCounting()
Start the countdown. Calls
OnStartCountingUnityEvent.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
No parameters
public virtual void StopCounting()
Stop the countdown. Calls
OnStopCountingUntiyEvent.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
No parameters
public virtual void SubtractTime(float subtractTime)
Remove time from the current countdown time.
| Expose Value | Overrideable | Returns |
|---|---|---|
| public | True | Does not return anything |
| Parameter Name | Description |
|---|---|
| subtractTime | float type, the amount of time to subtract. |
protected virtual void TimerEnded()
This is called when the timer reachs zero. It will call the
RemoveSyncTimefunction and theOnZeroUnityEvent. It also resets this timer so it can be used again.
| Expose Value | Overrideable | Returns |
|---|---|---|
| protected | True | Does not return anything |
No parameters
protected virtual void Update()
Responsible for subtracting time from the current time in an settings the display value parameter based on the
numberTypeparameter. Also calls thePlayAudioClipfunction when the time changes. It also calls theSetTextsfunction to set the display counting values. Finally it calls theOnZeroUnityEvent when reacing zero and theStopCountingfunction when it reaches zero.
| Expose Value | Overrideable | Returns |
|---|---|---|
| protected | True | Does not return anything |
No parameters