T
- The type of CellGame that uses the SpaceStates that this
ThinkerObject can be assigned topublic abstract class ThinkerObject<T extends CellGame> extends MobileObject<T>
A ThinkerObject is a MobileObject that acts like a SpaceThinker, possessing timers, various actions in response to events, and the capacity to act like a ThinkerGroup, even though it is not technically one.
Constructor and Description |
---|
ThinkerObject(Hitbox<T> locatorHitbox)
Creates a new ThinkerObject with the specified locator Hitbox.
|
Modifier and Type | Method and Description |
---|---|
void |
addedActions(T game,
SpaceState<T> state)
Actions for this ThinkerObject to take immediately after being added to a
new SpaceState.
|
boolean |
addThinker(SpaceThinker<T> thinker)
Adds the specified SpaceThinker to this ThinkerObject if it is not
already assigned to a ThinkerGroup.
|
void |
beforeMovementActions(T game,
SpaceState<T> state)
Actions for this ThinkerObject to take once every frame, after
SpaceThinkers take their timeUnitActions() but before its SpaceState
moves its assigned ThinkerObjects.
|
void |
frameActions(T game,
SpaceState<T> state)
Actions for this ThinkerObject to take once every frame after its
SpaceState moves its assigned ThinkerObjects.
|
int |
getActionPriority()
Returns this ThinkerObject's action priority.
|
int |
getNewActionPriority()
Returns the action priority that this ThinkerObject is about to have, but
does not yet have due to its SpaceState's SpaceThinker list being
iterated over.
|
int |
getNumThinkers()
Returns the number of SpaceThinkers that are assigned to this
ThinkerObject.
|
int |
getTimerValue(TimedEvent timedEvent)
Returns the current value of this ThinkerObject's timer for the specified
TimedEvent.
|
boolean |
iteratingThroughThinkers()
Returns whether any Iterators over this ThinkerObject's list of
SpaceThinkers are in progress.
|
void |
removeAllSubThinkers()
Removes from their ThinkerGroups all of the SpaceThinkers that are
directly or indirectly assigned to this ThinkerObject.
|
void |
removeAllThinkers()
Removes from this ThinkerObject all of the SpaceThinkers that are
currently assigned to it.
|
void |
removedActions(T game,
SpaceState<T> state)
Actions for this ThinkerObject to take immediately before being removed
from its current SpaceState.
|
boolean |
removeLineage(SpaceThinker<T> thinker)
Removes from their ThinkerGroups all of the SpaceThinkers that are
directly or indirectly assigned to this ThinkerObject, and are either
assigned to or assignees of the specified SpaceThinker.
|
boolean |
removeThinker(SpaceThinker<T> thinker)
Removes the specified SpaceThinker from this ThinkerObject if it is
currently assigned to it.
|
void |
setActionPriority(int actionPriority)
Sets this ThinkerObject's action priority to the specified value.
|
void |
setTimerValue(TimedEvent timedEvent,
int value)
Sets the value of this ThinkerObject's timer for the specified TimedEvent
to the specified value.
|
SafeIterator<SpaceThinker<T>> |
thinkerIterator()
Returns a new Iterator over this ThinkerObject's list of SpaceThinkers.
|
void |
timeUnitActions(T game,
SpaceState<T> state)
Actions for this ThinkerObject to take once every time unit, after
AnimationInstances update their indices but before SpaceThinkers take
their beforeMovementActions().
|
addFollower, changePosition, changePosition, changeStep, changeStep, changeStepX, changeStepY, changeX, changeY, clearFollowers, collide, collided, collided, doMovement, doMovement, getAbsPressingAngle, getCollisionDirections, getCollisionHitbox, getCollisions, getDisplacement, getDisplacementLength, getDisplacementX, getDisplacementY, getFollowers, getLeader, getMovementPriority, getNewMovementPriority, getNumFollowers, getRelPressingAngle, getSpeed, getStep, getStepLength, getStepX, getStepY, getVelocity, getVelocityX, getVelocityY, hasCollision, isPressingIn, moveToward, moveToward, removeFollower, setCollision, setCollisionHitbox, setGameState, setLeader, setMovementPriority, setPosition, setPosition, setRelPressingAngle, setRelPressingAngle, setSpeed, setStep, setStep, setStepLength, setStepX, setStepY, setVelocity, setVelocity, setVelocityX, setVelocityY, setX, setY, solidBoundingBoxesMeet
angleTo, boundingBoxesMeet, changeAngle, changePosition, changePosition, changeX, changeY, clearAnimInstances, distanceTo, draw, flipX, flipY, getAlpha, getAngle, getAngleX, getAngleY, getAnimation, getAnimation, getAnimInstance, getAnimInstance, getAppearance, getBottomEdge, getCenter, getCenterOffset, getCenterOffsetX, getCenterOffsetY, getCenterX, getCenterY, getDrawPriority, getEffectiveTimeFactor, getFilter, getGame, getGameState, getLeftEdge, getLocatorHitbox, getNewGameState, getOverlapHitbox, getPosition, getRightEdge, getSolidHitbox, getTimeFactor, getTopEdge, getX, getXFlip, getXSign, getY, getYFlip, getYSign, intersectingSolidObject, intersectingSolidObjects, isIntersectingSolidObject, isOverlappingObject, isSolid, isVisible, isVisible, nearestObject, nearestObjectWithinCircle, nearestObjectWithinCircle, nearestObjectWithinRadius, nearestObjectWithinRectangle, nearestOverlappingObject, objectIsWithinRadius, objectsWithinRadius, objectWithinRadius, overlap, overlappingObject, overlappingObjects, overlaps, setAlpha, setAngle, setAnimation, setAnimation, setAnimInstance, setAnimInstance, setAppearance, setCenterOffset, setCenterOffset, setCenterOffsetX, setCenterOffsetY, setDrawPriority, setFilter, setGameState, setLocatorHitbox, setOverlapHitbox, setPosition, setPosition, setSolid, setSolidHitbox, setSurfaceSolid, setTimeFactor, setX, setXFlip, setY, setYFlip, surfaceIsSolid
public final int getNumThinkers()
public final boolean iteratingThroughThinkers()
public final SafeIterator<SpaceThinker<T>> thinkerIterator()
public final boolean addThinker(SpaceThinker<T> thinker)
thinker
- The SpaceThinker to be addedpublic final boolean removeThinker(SpaceThinker<T> thinker)
thinker
- The SpaceThinker to be removedpublic final void removeAllThinkers()
public final void removeAllSubThinkers()
public final boolean removeLineage(SpaceThinker<T> thinker)
thinker
- The SpaceThinker with which the removed SpaceThinkers must
share a lineage of assignmentspublic final int getActionPriority()
public final int getNewActionPriority()
public final void setActionPriority(int actionPriority)
actionPriority
- The new action prioritypublic final int getTimerValue(TimedEvent timedEvent)
timedEvent
- The TimedEvent whose timer value should be returnedpublic final void setTimerValue(TimedEvent timedEvent, int value)
timedEvent
- The TimedEvent whose timer value should be setvalue
- The new value of the specified TimedEvent's timerpublic void addedActions(T game, SpaceState<T> state)
game
- This ThinkerObject's SpaceState's CellGamestate
- This ThinkerObject's SpaceStatepublic void removedActions(T game, SpaceState<T> state)
game
- This ThinkerObject's SpaceState's CellGamestate
- This ThinkerObject's SpaceStatepublic void timeUnitActions(T game, SpaceState<T> state)
game
- This ThinkerObject's SpaceState's CellGamestate
- This ThinkerObject's SpaceStatepublic void beforeMovementActions(T game, SpaceState<T> state)
game
- This ThinkerObject's SpaceState's CellGamestate
- This ThinkerObject's SpaceStatepublic void frameActions(T game, SpaceState<T> state)
game
- This ThinkerObject's SpaceState's CellGamestate
- This ThinkerObject's SpaceState