Package sk.tuke.kpi.gamelib.actions
Interface Action<A extends Actor>
-
- All Known Implementing Classes:
ActionParallel
,ActionSequence
,Invoke
,TemporalAction
,Wait
,When
,While
public interface Action<A extends Actor>
Action that is performed by an actor of type A in a particular scene. Each call to theexecute(float)
method moves the action one step forward. When the actionis done
, itsexecute(float)
method is no longer being called by the scene.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
execute(float deltaTime)
Executes (one step of) the action.A
getActor()
boolean
isDone()
void
reset()
Resets the state of the action, except the assigned actor.default @NotNull Disposable
scheduleFor(A actor)
A helper method that provides "fluent API" for registering the action on actor's scene.default @NotNull Disposable
scheduleOn(@NotNull Scene scene)
A helper method that provides "fluent API" for registering the action on the scene.void
setActor(A actor)
Sets actor for the action
-
-
-
Method Detail
-
getActor
@Nullable A getActor()
- Returns:
- actor that performs the action
-
setActor
void setActor(@Nullable A actor)
Sets actor for the action- Parameters:
actor
- actor to be set for action
-
isDone
boolean isDone()
- Returns:
- true if the action is done, false otherwise
-
execute
void execute(float deltaTime)
Executes (one step of) the action. Called by the scene this action was scheduled on, prior to rendering.- Parameters:
deltaTime
- time passed from the previous execution
-
reset
void reset()
Resets the state of the action, except the assigned actor.
-
scheduleFor
@NotNull default @NotNull Disposable scheduleFor(@NotNull A actor)
A helper method that provides "fluent API" for registering the action on actor's scene.- See Also:
Scene.scheduleAction(Action, Actor)
-
scheduleOn
@NotNull default @NotNull Disposable scheduleOn(@NotNull @NotNull Scene scene)
A helper method that provides "fluent API" for registering the action on the scene.- See Also:
Scene.scheduleAction(Action)
-
-