T - Type of vector, either 2D or 3D, implementing the Vector interfacepublic abstract class SteeringBehavior<T extends com.badlogic.gdx.math.Vector<T>>
extends java.lang.Object
SteeringBehavior calculates the linear and/or angular accelerations to be applied to its owner.| Modifier and Type | Field and Description |
|---|---|
protected boolean |
enabled
A flag indicating whether this steering behavior is enabled or not.
|
protected Limiter |
limiter
The limiter of this steering behavior
|
protected Steerable<T> |
owner
The owner of this steering behavior
|
| Constructor and Description |
|---|
SteeringBehavior(Steerable<T> owner)
Creates a
SteeringBehavior for the specified owner. |
SteeringBehavior(Steerable<T> owner,
boolean enabled)
Creates a
SteeringBehavior for the specified owner and activation flag. |
SteeringBehavior(Steerable<T> owner,
Limiter limiter)
Creates a
SteeringBehavior for the specified owner and limiter. |
SteeringBehavior(Steerable<T> owner,
Limiter limiter,
boolean enabled)
Creates a
SteeringBehavior for the specified owner, limiter and activation flag. |
| Modifier and Type | Method and Description |
|---|---|
protected abstract SteeringAcceleration<T> |
calculateRealSteering(SteeringAcceleration<T> steering)
Calculates the steering acceleration produced by this behavior and writes it to the given steering output.
|
SteeringAcceleration<T> |
calculateSteering(SteeringAcceleration<T> steering)
If this behavior is enabled calculates the steering acceleration and writes it to the given steering output.
|
protected Limiter |
getActualLimiter()
Returns the actual limiter of this steering behavior.
|
Limiter |
getLimiter()
Returns the limiter of this steering behavior.
|
Steerable<T> |
getOwner()
Returns the owner of this steering behavior.
|
boolean |
isEnabled()
Returns true if this steering behavior is enabled; false otherwise.
|
protected T |
newVector(Location<T> location)
Utility method that creates a new vector.
|
SteeringBehavior<T> |
setEnabled(boolean enabled)
Sets this steering behavior on/off.
|
SteeringBehavior<T> |
setLimiter(Limiter limiter)
Sets the limiter of this steering behavior.
|
SteeringBehavior<T> |
setOwner(Steerable<T> owner)
Sets the owner of this steering behavior.
|
protected Steerable<T extends com.badlogic.gdx.math.Vector<T>> owner
protected Limiter limiter
protected boolean enabled
public SteeringBehavior(Steerable<T> owner)
SteeringBehavior for the specified owner. The behavior is enabled and has no explicit limiter, meaning
that the owner is used instead.owner - the owner of this steering behaviorpublic SteeringBehavior(Steerable<T> owner, Limiter limiter)
SteeringBehavior for the specified owner and limiter. The behavior is enabled.owner - the owner of this steering behaviorlimiter - the limiter of this steering behaviorpublic SteeringBehavior(Steerable<T> owner, boolean enabled)
SteeringBehavior for the specified owner and activation flag. The behavior has no explicit limiter,
meaning that the owner is used instead.owner - the owner of this steering behaviorenabled - a flag indicating whether this steering behavior is enabled or notpublic SteeringBehavior(Steerable<T> owner, Limiter limiter, boolean enabled)
SteeringBehavior for the specified owner, limiter and activation flag.owner - the owner of this steering behaviorlimiter - the limiter of this steering behaviorenabled - a flag indicating whether this steering behavior is enabled or notpublic SteeringAcceleration<T> calculateSteering(SteeringAcceleration<T> steering)
steering - the steering acceleration to be calculated.protected abstract SteeringAcceleration<T> calculateRealSteering(SteeringAcceleration<T> steering)
This method is called by calculateSteering(SteeringAcceleration) when this steering behavior is enabled.
steering - the steering acceleration to be calculated.public SteeringBehavior<T> setOwner(Steerable<T> owner)
public Limiter getLimiter()
public SteeringBehavior<T> setLimiter(Limiter limiter)
public boolean isEnabled()
public SteeringBehavior<T> setEnabled(boolean enabled)
protected Limiter getActualLimiter()
protected T newVector(Location<T> location)
This method is used internally to instantiate vectors of the correct type parameter T. This technique keeps the API
simple and makes the API easier to use with the GWT backend because avoids the use of reflection.
location - the location whose position is used to create the new vector