An interactable component with a composable feature set.
Verse using statement |
using { /Verse.org/SceneGraph } |
Inheritance Hierarchy
This class is derived from the following hierarchy, starting with component
:
Name | Description |
---|---|
component |
Base class for authoring logic and data in the SceneGraph. Using components you can author re-usable building blocks of logic and data which can then be added to entities in the scene. Components are a very low level building block which can be used in many ways. For example:
As components are generic there is no specific way that they must be used. It is up to the needs of your experience if you use one big game component or if you break up logic into many small components. Classes deriving from component must also specify Only one instance of a component from each subclass group can be added to an entity at a time. For example, given this group of components, only one light_component can exist on a single entity. To create multiple lights you should use multiple entities. light_component := class ============================================================================== Component Lifetime Components move through a series of lifetime functions as they are added to entities, added to the scene, and begin running in the simulation. Components should override these methods to perform setup and run their simulation. As a component shuts down it will then move through shutdown version of these
functions, giving users the opportunity to clean up any retained state on the
component before it is disposed
.
Lifetime Methods:
OnAddedToScene
OnBeginSimulation -> OnSimulate |
interactable_component |
Used to handle general interaction. |
Members
This class has both data members and functions.
Data
Data Member Name | Type | Description |
---|---|---|
CanceledEvent |
unknown |
Event fires when an interaction has ended before completing successfully. Sends the formerly interacting agent. interactable_component cannot be canceled, this event is provided for subclasses to fire where appropriate. |
Cooldown |
?interactable_cooldown |
Cooldowns begin elapsing on successful interactions. A cooldown which applies for all attempts to interact on this component. |
CooldownPerAgent |
?interactable_cooldown_per_agent |
Cooldowns begin elapsing on successful interactions. A cooldown which applies for future attempts to interact on this component by the agent which succeeded. |
Entity |
entity |
The parent entity of this component.
|
InteractableDuration |
?interactable_duration |
An interaction with a duration does not succeed until the duration has elapsed, and success is not guaranteed as it can be canceled while the duration is active. |
InteractingAgents |
?[]agent |
The agents which are currently interacting with this interactable. |
StartedEvent |
unknown |
Event fires when an a successful interaction starts. Sends the interacting agent. InteractDuration at or below 0 makes this event identical to InteractSucceededEvent. |
SucceededEvent |
unknown |
Event fires when an interaction has completed successfully. Sends the formerly interacting agent. InteractDuration at or below 0 makes this event identical to InteractStartedEvent. |
SuccessLimit |
?interactable_success_limit |
Success limits prevent new interactions once the component has been successfully interacted with a specified number of times. |
TickEvents |
?tick_events |
Set callbacks to |
Functions
Function Name | Description |
---|---|
Cancel |
Attempt to cancel an interaction. Fails if the supplied agent is not currently interacting with the component. |
CanInteract |
Returns whether the specified agent can interact. |
Disable |
Disable interaction with the component. Disabled components do not provide interaction prompts. |
Enable |
Enable interaction with the component. |
GetRemainingCooldownDurationAffectingAgent |
Get the remaining cooldown of the interactable for the supplied agent. This returns the duration left in seconds of either the shared or per agent cooldown, whichever is greater. Returns the same value when called multiple times within a transaction. |
InteractMessage |
Returns an appropriate message to display to players to communicate the current state of the interactable. |
IsEnabled |
Succeeds if the component is enabled, fails if it’s disabled. |
IsInScene |
Succeeds if the component is currently in the scene.
|
IsSimulating |
Succeeds if the component is currently simulating.
|
OnAddedToScene |
Called when the component is added to the scene by parenting it under the simulation entity or another entity already in the scene.
|
OnBeginSimulation |
Called when the component begins simulating within the scene.
|
OnEndSimulation |
Called when the component ends simulation within the scene.
|
OnReceive |
Respond to an event being propagated through the scene graph. Returns if the event is consumed, in which case the event will not be passed to the next entity, depending on how the event is being sent through the hierarchy. |
OnRemovingFromScene |
Called when the component is about to be removed from the scene.
|
OnSimulate |
Called when the component begins simulating within the scene.
|
OnStarted |
Called from Start if CanInteract pass successfully to start the interaction. Overriding this function will allow you to create a custom interaction behaviour. |
RemoveFromEntity |
Removes the component from the entity.
|
SignalCancelEvent |
Fires the CanceledEvent event. |
SignalStartEvent |
Fires the StartedEvent event. |
SignalSucceedEvent |
Fires the SucceededEvent event. |
Start |
Attempt to start an interaction. Fails if the agent does not pass the CanInteract function. |
Succeed |
Attempt to succeed at an interaction. Success will also happen automatically after InteractDuration has elapsed after starting an interaction. Fails if the supplied agent is not currently interacting with the component. |