Package sk.tuke.kpi.gamelib.actions
Class While<A extends Actor>
- java.lang.Object
-
- sk.tuke.kpi.gamelib.actions.While<A>
-
- All Implemented Interfaces:
Action<A>
public final class While<A extends Actor> extends java.lang.Object implements Action<A>
Executes action repeatedly while the predicate istrue
. When the predicate changes fromtrue
tofalse
, the currently executed action continues until it finishes and then theWhile
action finishes as well. It will not be executed again even if the predicate becomestrue
again.The constructor expects either a predicate that accepts
While
action as a parameter, or a parameter-less predicate.
-
-
Method Summary
All Methods Instance Methods Concrete 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.void
setActor(A actor)
Sets actor for the action-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface sk.tuke.kpi.gamelib.actions.Action
scheduleFor, scheduleOn
-
-
-
-
Method Detail
-
getActor
@Nullable public A getActor()
-
setActor
public void setActor(@Nullable A actor)
Description copied from interface:Action
Sets actor for the action
-
isDone
public boolean isDone()
-
execute
public void execute(float deltaTime)
Description copied from interface:Action
Executes (one step of) the action. Called by the scene this action was scheduled on, prior to rendering.
-
-