StunComponent
Alex Crimi edited this page Oct 14, 2021
·
5 revisions
Extends StatefulComponent
StunComponent
is a simple extension of StatefulComponent to represent an stunned state for an entity. It will automatically be activated if a HurtBoxComponent is present and has detected a hit.
When used inside the components
block, the initial state of the component can be configured with the following parameters:
Key | Type | Description |
---|---|---|
duration* | float | The duration, in seconds, of the "active" state for this component. Defaults to -1 , which is treated as infinite duration. |
enterStates* | (string|object)[] | An array of states that will be passed through when going from the "inactive" state to the "active" state. Each state can be defined as either an object with a single key value pair corresponding the state's name and duration, or as a string representing the state name. States defined as a string will have an infinite duration. The array values can be heterogenous. |
[stateName]* | float | The key represents the name of this state and the value is the duration, in seconds. For infinite duration, use a value of -1
|
exitStates* | (string|object)[] | An array of states that will be passed through when going from the "active" state to the "inactive" state. Each state can be defined as either an object with a single key value pair corresponding the state's name and duration, or as a string representing the state name. States defined as a string will have an infinite duration. The array values can be heterogenous. |
[stateName]* | float | The key represents the name of this state and the value is the duration, in seconds. For infinite duration, use a value of -1
|
initialState* | string | The state the component will start in. Must be one of "inactive" , "active" , or any of the custom states provided via enterStates or exitStates . By default, the component will start in the "inactive" state. Setting a different initial state will not cause events to fire for entering that state. |
isActive* | boolean | Equivalent to passing "active" to initialState . Defaults to false . |
* from StatefulComponent
Example:
"StunComponent": {
"duration": 0.6
}
The following properties are readable by property accessors (eg render state and persistence definitions):
Key | Type | Description |
---|---|---|
isActive* | boolean | Whether or not the current state is "active"
|
isInactive* | boolean | Whether or not the current state is "inactive"
|
state* | string | The name of the current state |
progress* | float | The percentage, from 0 to 1 , of how much time has elapsed for the current state relative to its duration (elapsedTime / duration). If the current state has an infinite duration, this value is always 0 . |
* from StatefulComponent
Overview
Components
Events
Update Scope
Filtering
Persistence
Variables
Value Resolution
Component Reference
- AgeComponent
- AIChargeComponent
- AIPatrolComponent
- CarryComponent
- ChargeComponent
- ChildLinkedComponent
- CollisionComponent
- ContainableComponent
- ContainerComponent
- CorneringComponent
- DeathComponent
- DestroyOnImpactComponent
- GrabComponent
- HealthComponent
- HitBoxComponent
- HurtBoxComponent
- InputComponent
- InteractableComponent
- InteractionComponent
- InvisibilityComponent
- InvulnerabilityComponent
- ItemActionComponent
- LiftableComponent
- LiftComponent
- MovementComponent
- OpenableComponent
- PhysicsComponent
- PullableComponent
- PullComponent
- PushableComponent
- PushComponent
- RenderComponent
- SafeRespawnComponent
- SelfDestructComponent
- SightComponent
- SpatialComponent
- SpawnComponent
- StatefulComponent
- StickyHitComponent
- StunComponent
- SurfaceComponent
- TerrainAwareComponent
- TerrainComponent
- ThrowComponent
- ThrustComponent
- TransformComponent
- TriggerComponent
- WeightTriggerComponent
- ZComponent
- AutoTetherComponent*
- DialogComponent*
- EquipmentComponent*
- FallComponent*
- ItemContainerComponent*
- LavaSinkComponent*
- LedgeHopComponent*
- RollComponent*
- SinkComponent*
- ShadeFormComponent*
- SwimComponent*
- TerrainDamageComponent*
- TetherableComponent*
- TetherComponent*
- TetherPullComponent*
- ThermalComponent*
Action Reference
- ActivateComponentAction
- AddComponentAction
- AttachComponentAction
- ChildAction
- ComponentAction
- DeactivateComponentAction
- DestroyChildAction
- DestroyEntityAction
- DetachChildAction
- DetachComponentAction
- EventAction
- RemoveComponentAction
- RequestRespawnAction
- ResetComponentAction
- SpawnAction
- StopSoundAction
- ToggleStateAction
- TriggerSoundAction
- StopMovementAction*