Package sk.tuke.kpi.gamelib.actions
Class TemporalAction<A extends Actor>
- java.lang.Object
-
- sk.tuke.kpi.gamelib.actions.TemporalAction<A>
-
- All Implemented Interfaces:
Action<A>
- Direct Known Subclasses:
Wait
public abstract class TemporalAction<A extends Actor> extends java.lang.Object implements Action<A>
A base class for actions with duration. The overall effect should be linearly distributed through time. When the action first starts, begin method is called. Then, each time the action is executed, update method gets called with the overall progress percentage passed to it. When the action ends, end method is called once.
-
-
Constructor Summary
Constructors Constructor Description TemporalAction(float duration)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
begin()
@NotNull TemporalAction<A>
during(float seconds)
protected void
end()
void
execute(float deltaTime)
Executes (one step of) the action.float
getDuration()
float
getTime()
boolean
isBegan()
boolean
isDone()
void
reset()
Resets the state of the action, except the assigned actor.abstract void
update(float progress)
-
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
getActor, scheduleFor, scheduleOn, setActor
-
-
-
-
Method Detail
-
during
@NotNull public @NotNull TemporalAction<A> during(float seconds)
-
getDuration
public float getDuration()
-
getTime
public float getTime()
-
isBegan
public boolean isBegan()
-
isDone
public final boolean isDone()
-
begin
protected void begin()
-
end
protected void end()
-
update
public abstract void update(float progress)
-
execute
public final 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.
-
-