Value <T>

Methods

Subscribe To Change

PUT SubscribeToChange(ChangeEvent newEvent)

Invoking this method will subscribe the passed method to the Change event; this means that it will get invoked whenever this value changes.

Path Parameters

Name
Type
Description

NewEvent

object

Method we want to invoke when this Value changes.

private void OnChange_Grounded(object old, object newValue){
    Debug.Log("Grounded State: " + (bool)new);
}

PlayerEvents.Grounded.SubscribeToChange(OnChange_Grounded);

Set

PUT Set(object newValue)

Sets a new object as the current Value. It also makes sure that the new value isn't the same so as to not invoke our listeners for no reason.

Path Parameters

Name
Type
Description

NewValue

object

The value we are trying to set as the current.

PlayerEvents.GroundState.Set(controller.isGrounded);

Get

GET Get()

Requests the current Value.

var cState = PlayerEvents.GroundState.Get();

Debug

OPTIONS Debug(bool debugValue, string name)

This method is used to debug all of the values that the Value currently holds; it is mostly used as a convenience when debugging.

Path Parameters

Name
Type
Description

Name

string

Decides what name we will debug in front of the other information.

DebugValue

boolean

Determines if we're only debugging the listeners, or we should add the current value as well.

PlayerEvents.GroundState.Debug(false, "GroundState");

Last updated

Was this helpful?