Package com.xebisco.yield
Class AbstractBehavior
java.lang.Object
com.xebisco.yield.AbstractBehavior
- All Implemented Interfaces:
Behavior,Closeable,AutoCloseable
- Direct Known Subclasses:
Application,ComponentBehavior,Entity2DContainer,SystemBehavior
Provides an abstract implementation of the
Behavior interface,
tracking the number of frames since its activation and defining the lifecycle of a behavior.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongframes()Returns the number of frames since the behavior started.voidtick(ContextTime time) Updates the behavior each frame.
-
Constructor Details
-
AbstractBehavior
public AbstractBehavior()
-
-
Method Details
-
tick
Updates the behavior each frame. It callsonStart()on the first frame, then callsonUpdate(ContextTime)on every frame including the first.- Parameters:
time- The context time for the current frame, providing timing information.
-
frames
public long frames()Returns the number of frames since the behavior started.- Returns:
- The number of frames since the behavior was activated.
-