Class SignalCondition
- All Implemented Interfaces:
EventCondition, EventCondition.Event<WorldEventSignal>
WorldEventSignal with a matching id is delivered to the world's
ConditionManager. Only listens while its stage is active, so signals sent before
the stage is reached are not buffered.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classNested classes/interfaces inherited from interface EventCondition
EventCondition.Event<T>, EventCondition.Ticking, EventCondition.TrackedEvent<T>, EventCondition.Type -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final BuilderCodec<SignalCondition> static final Stringstatic final EventCondition.TypeFields inherited from interface EventCondition
ARRAY_CODEC, EMPTY_ARRAY, TYPE_CODEC -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the exact class of the ECS event this condition handles.voidhandle(World world, WorldEventSignal event) Processes an incoming ECS event and updates internal state.booleanonStart(WorldEvent event) Called when the stage this condition belongs to begins, afterEventCondition.reset().voidreset()Resets the condition to its unsatisfied state before a new stage iteration begins.booleantest()Returnstruewhen this condition has been satisfied.Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface EventCondition
merge, onCancel, onComplete
-
Field Details
-
ID
- See Also:
-
TYPE
-
CODEC
-
-
Constructor Details
-
SignalCondition
public SignalCondition()
-
-
Method Details
-
test
public boolean test()Description copied from interface:EventConditionReturnstruewhen this condition has been satisfied.This method is called frequently and must be side-effect free. Update internal state in
EventCondition.Ticking.tick(float, Store)orEventCondition.Event.handle(World, T)instead.- Specified by:
testin interfaceEventCondition- Returns:
trueif the condition is met
-
reset
public void reset()Description copied from interface:EventConditionResets the condition to its unsatisfied state before a new stage iteration begins.Called before
EventCondition.onStart(WorldEvent)at the start of a stage. All transient fields (timers, flags, cached context references) should be cleared here.- Specified by:
resetin interfaceEventCondition
-
eventType
Description copied from interface:EventCondition.EventReturns the exact class of the ECS event this condition handles.- Specified by:
eventTypein interfaceEventCondition.Event<WorldEventSignal>- Returns:
- the event class; must match the type parameter
Texactly
-
handle
Description copied from interface:EventCondition.EventProcesses an incoming ECS event and updates internal state.This is called for every matching event, not only for events that are relevant to this specific condition instance. Implementations must check (e.g. by comparing UUIDs) whether the event is relevant before updating state.
- Specified by:
handlein interfaceEventCondition.Event<WorldEventSignal>- Parameters:
world- the world in which the event was firedevent- the ECS event
-
onStart
Description copied from interface:EventConditionCalled when the stage this condition belongs to begins, afterEventCondition.reset().Implementations typically use this to look up values in the event context that the condition needs in order to operate (e.g. a location or a child event reference). If a required context value is absent, log a warning and return
falseto abort the stage immediately.- Specified by:
onStartin interfaceEventCondition- Parameters:
event- the world event whose stage is starting- Returns:
falseto abort the stage before it runs
-