Class EventAction<T extends Event>

java.lang.Object
com.prineside.tdi2.scene2d.Action
com.prineside.tdi2.scene2d.actions.EventAction<T>
All Implemented Interfaces:
Pool.Poolable
Direct Known Subclasses:
CountdownEventAction

public abstract class EventAction<T extends Event> extends Action
Adds a listener to the actor for a specific event type and does not complete until handle(Event) returns true.
Author:
JavadocMD, Nathan Sweet
  • Constructor Details

    • EventAction

      public EventAction(Class<? extends T> eventClass)
  • Method Details

    • restart

      public void restart()
      Description copied from class: Action
      Sets the state of the action so it can be run again.
      Overrides:
      restart in class Action
    • setTarget

      public void setTarget(Actor newTarget)
      Description copied from class: Action
      Sets the actor this action will manipulate. If no target actor is set, Action.setActor(Actor) will set the target actor when the action is added to an actor.
      Overrides:
      setTarget in class Action
    • handle

      public abstract boolean handle(T event)
      Called when the specific type of event occurs on the actor.
      Returns:
      true if the event should be considered handled and this EventAction considered complete.
    • act

      public boolean act(float delta)
      Description copied from class: Action
      Updates the action based on time. Typically this is called each frame by Actor.act(float).
      Specified by:
      act in class Action
      Parameters:
      delta - Time in seconds since the last frame.
      Returns:
      true if the action is done. This method may continue to be called after the action is done.
    • isActive

      public boolean isActive()
    • setActive

      public void setActive(boolean active)