class MAGES::SceneGraph::UseBehavior

Overview

Behavior for the Use Action. More…

class UseBehavior: public MAGES::SceneGraph::BaseBehavior
{
public:
    // properties

    List UseColliders;
    float TimetoUse;
    float ElapsedTime;
    bool ResetTimerOnExit;
    bool UseColliderIsTrigger;
    bool IsActivationRequired;
    float HapticIntensity;
    UnityEvent OnUsed;
    UnityEvent OnCollisionEnterEvent;
    UnityEvent OnCollisionStayEvent;
    UnityEvent OnCollisionExitEvent;

    // methods

    void InitializeActionBehavior();
    void Rearm();
};

Inherited Members

public:
    // properties

    string ObjectID;
    BaseActionData ActionData;

Detailed Documentation

Behavior for the Use Action.

Properties

List UseColliders

Gets or sets the use Collider.

float TimetoUse

Gets or sets the time to use the object. If 0, the object will perform the action as soon as the user touches it.

float ElapsedTime

Gets or sets a value indicating the elapsed time since the timer began.

bool ResetTimerOnExit

Gets or sets a value indicating whether the timer resets on exit.

bool UseColliderIsTrigger

Gets or sets a value indicating whether the colliders of the Use Collider object will be set to trigger.

bool IsActivationRequired

Gets or sets a value indicating whether the object needs to be activated.

float HapticIntensity

Gets or sets the haptic intensity, for the haptics while using the object.

UnityEvent OnUsed

Gets the event.

UnityEvent OnCollisionEnterEvent

Gets the on triggered event.

UnityEvent OnCollisionStayEvent

Gets the on triggered event.

UnityEvent OnCollisionExitEvent

Gets the on triggered event.

Methods

void InitializeActionBehavior()

Initializes the action behavior and sets up everything needed for the action to work.

void Rearm()

Puts the collider that completed the last attempt back in play, so the object can be used again.

Called by the action when a condition declines the trigger. Only the final collider comes back - the earlier ones of a multi-collider use are gone, and the retry only has to repeat the step that fired the trigger. It comes back once the object has been pulled out of it: handing it over right away would let a zero-second use fire the trigger again on the very next physics step, over and over for as long as the condition keeps declining.