Class R.components.logic.behaviors.Arrival
Extends
R.components.logic.behaviors.BaseBehavior.
The arrival behavior component. Causes the vehicle to seek the destination, but slow as it
approaches it.
Defined in: arrival.js.
Constructor Attributes | Constructor Name and Description |
---|---|
R.components.logic.behaviors.Arrival(destination, slowingDistance)
|
- Fields borrowed from class R.components.Base:
- TYPE_COLLIDER, TYPE_INPUT, TYPE_LOGIC, TYPE_RENDERING, TYPE_TRANSFORM
Method Attributes | Method Name and Description |
---|---|
execute(renderContext, time, dt)
This method is called by the game object to run the component,
updating its state.
|
|
True if the vehicle has "arrived" at it's destination
|
|
setTarget(target)
Set the target to seek.
|
- Methods borrowed from class R.components.logic.behaviors.BaseBehavior:
- getTransformComponent, setTransformComponent
- Methods borrowed from class R.components.Logic:
- getClassName
- Methods borrowed from class R.components.Base:
- getGameObject, getHostObject, getPriority, getType, getTypeString, release, setGameObject, setHostObject, setPriority
- Methods borrowed from class R.engine.BaseObject:
- addEvent, addEvents, destroy, getElement, jQ, removeEvent, setElement, triggerEvent, update
- Methods borrowed from class R.engine.PooledObject:
- clearObjectDataModel, getId, getName, getObjectDataModel, getProperties, isDestroyed, setName, setObjectDataModel, toString, toXML
Class Detail
R.components.logic.behaviors.Arrival(destination, slowingDistance)
- Parameters:
- destination
- The point to seek
- slowingDistance Optional
- The distance (in pixels) at which slowing should occur. The velocity will be scaled as it nears the destination and stop when it is at, or almost at, the destination.
Method Detail
execute(renderContext, time, dt)
This method is called by the game object to run the component,
updating its state.
- Parameters:
- renderContext
- {R.rendercontexts.AbstractRenderContext} The context the component will render within.
- time
- {Number} The global engine time
- dt
- {Number} The delta between the world time and the last time the world was updated in milliseconds.
{Boolean}
isArrived()
True if the vehicle has "arrived" at it's destination
- Returns:
- {Boolean}
setTarget(target)
Set the target to seek.
- Parameters:
- target
- {R.math.Point2D|R.objects.Object2D} The point, or object, to seek.