import Vector from '../math/Vector'; import Location from '../utils/Location'; import Limiter from './Limiter'; import Steerable from './Steerable'; import SteeringAcceleration from './SteeringAcceleration'; /** * A {@code SteeringBehavior} calculates the linear and/or angular accelerations to be applied to its owner. * * @param Type of vector, either 2D or 3D, implementing the {@link Vector} interface * * @author davebaol */ declare abstract class SteeringBehavior> { /** The owner of this steering behavior */ protected owner: Steerable; /** The limiter of this steering behavior */ protected limiter: Limiter; /** A flag indicating whether this steering behavior is enabled or not. */ protected enabled: boolean; /** * Creates a {@code SteeringBehavior} for the specified owner, limiter and activation flag. * * @param owner the owner of this steering behavior * @param limiter the limiter of this steering behavior * @param enabled a flag indicating whether this steering behavior is enabled or not */ constructor(owner: Steerable, limiter?: Limiter, enabled?: boolean); /** * If this behavior is enabled calculates the steering acceleration and writes it to the given steering output. If it is * disabled the steering output is set to zero. * @param steering the steering acceleration to be calculated. * @return the calculated steering acceleration for chaining. */ calculateSteering(steering: SteeringAcceleration): SteeringAcceleration; /** Returns the owner of this steering behavior. */ getOwner(): Steerable; /** * Sets the owner of this steering behavior. * @return this behavior for chaining. */ setOwner(owner: Steerable): SteeringBehavior; /** Returns the limiter of this steering behavior. */ getLimiter(): Limiter; /** * Sets the limiter of this steering behavior. * @return this behavior for chaining. */ setLimiter(limiter: Limiter): SteeringBehavior; /** Returns true if this steering behavior is enabled; false otherwise. */ isEnabled(): boolean; /** * Sets this steering behavior on/off. * @return this behavior for chaining. */ setEnabled(enabled: boolean): SteeringBehavior; /** * Calculates the steering acceleration produced by this behavior and writes it to the given steering output. *

* This method is called by {@link #calculateSteering(SteeringAcceleration)} when this steering behavior is enabled. * @param steering the steering acceleration to be calculated. * @return the calculated steering acceleration for chaining. */ protected abstract calculateRealSteering(steering: SteeringAcceleration): SteeringAcceleration; /** Returns the actual limiter of this steering behavior. */ protected getActualLimiter(): Limiter; /** * Utility method that creates a new vector. *

* This method is used internally to instantiate vectors of the correct type parameter {@code T}. This technique keeps the API * simple and makes the API easier to use with the GWT backend because avoids the use of reflection. * * @param location the location whose position is used to create the new vector * @return the newly created vector */ protected newVector(location: Location): T; } export default SteeringBehavior;