public abstract class DelegateAction extends Action
| Constructor and Description |
|---|
DelegateAction() |
| Modifier and Type | Method and Description |
|---|---|
Action |
getAction() |
void |
reset()
Resets the optional state of this action to as if it were newly created, allowing the action to be pooled and reused.
|
void |
restart()
Sets the state of the action so it can be run again.
|
void |
setAction(Action action)
Sets the wrapped action.
|
void |
setActor(Actor actor)
Sets the actor this action will be used for.
|
java.lang.String |
toString() |
protected Action action
public void setAction(Action action)
public Action getAction()
public void restart()
Actionpublic void reset()
Action
The default implementation calls Action.restart().
If a subclass has optional state, it must override this method, call super, and reset the optional state.
reset in interface Pool.Poolablereset in class Actionpublic void setActor(Actor actor)
Actionpool
then the action is returned to the pool (which calls Action.reset()) and the pool is set to null.
If the action does not have a pool, Action.reset() is called.
This method is not typically a good place for a subclass to query the actor's state because the action may not be executed
for some time, eg it may be delayed. The actor's state is best queried in the first call to
Action.act(float). For a TemporalAction, use TemporalAction#begin().