Class TemporalAction<A extends Actor>

  • 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 Detail

      • TemporalAction

        public TemporalAction​(float duration)
    • 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()
        Specified by:
        isDone in interface Action<A extends Actor>
        Returns:
        true if the action is done, false otherwise
      • 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.
        Specified by:
        execute in interface Action<A extends Actor>
        Parameters:
        deltaTime - time passed from the previous execution
      • reset

        public void reset()
        Description copied from interface: Action
        Resets the state of the action, except the assigned actor.
        Specified by:
        reset in interface Action<A extends Actor>