Class KaijuTargetMovement
Base movement class for moving in relation to a single target.
Inheritance
Inherited Members
Namespace: KaijuSolutions.Agents.Movement
Syntax
public abstract class KaijuTargetMovement : KaijuMovement
Constructors
KaijuTargetMovement(KaijuAgent, Component, Single, Single)
Create the target movement for a component.
Declaration
protected KaijuTargetMovement(KaijuAgent agent, Component target, float distance, float weight = 1F)
Parameters
| Type | Name | Description |
|---|---|---|
| KaijuAgent | agent | The KaijuAgent this is assigned to. |
| Component | target | The component to move in relation to. |
| System.Single | distance | The distance to consider this move done. |
| System.Single | weight | The weight of this KaijuMovement. |
KaijuTargetMovement(KaijuAgent, GameObject, Single, Single)
Create the target movement for a GameObject.
Declaration
protected KaijuTargetMovement(KaijuAgent agent, GameObject target, float distance, float weight = 1F)
Parameters
| Type | Name | Description |
|---|---|---|
| KaijuAgent | agent | The KaijuAgent this is assigned to. |
| GameObject | target | The GameObject to move in relation to. |
| System.Single | distance | The distance to consider this move done. |
| System.Single | weight | The weight of this KaijuMovement. |
KaijuTargetMovement(KaijuAgent, Vector2, Single, Single)
Create the target movement for a Vector2.
Declaration
protected KaijuTargetMovement(KaijuAgent agent, Vector2 target, float distance, float weight = 1F)
Parameters
| Type | Name | Description |
|---|---|---|
| KaijuAgent | agent | The KaijuAgent this is assigned to. |
| Vector2 | target | The vector to move in relation to. |
| System.Single | distance | The distance to consider this move done. |
| System.Single | weight | The weight of this KaijuMovement. |
KaijuTargetMovement(KaijuAgent, Vector3, Single, Single)
Create the target movement for a Vector3.
Declaration
protected KaijuTargetMovement(KaijuAgent agent, Vector3 target, float distance, float weight = 1F)
Parameters
| Type | Name | Description |
|---|---|---|
| KaijuAgent | agent | The KaijuAgent this is assigned to. |
| Vector3 | target | The vector to move in relation to. |
| System.Single | distance | The distance to consider this move done. |
| System.Single | weight | The weight of this KaijuMovement. |
Properties
CurrentDistance
The current distance between the KaijuAgent and the target.
Declaration
public float CurrentDistance { get; }
Property Value
| Type | Description |
|---|---|
| System.Single |
CurrentDistance3
The current distance between the KaijuAgent and the target across all axes.
Declaration
public float CurrentDistance3 { get; }
Property Value
| Type | Description |
|---|---|
| System.Single |
Distance
The distance at which we can consider this behaviour done.
Declaration
public float Distance { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Single |
Target
The position to move in relation to.
Declaration
public Vector2 Target { get; set; }
Property Value
| Type | Description |
|---|---|
| Vector2 |
Target3
The position to move in relation to.
Declaration
public Vector3 Target3 { get; set; }
Property Value
| Type | Description |
|---|---|
| Vector3 |
TargetAgent
The KaijuAgent to move in relation to.
Declaration
public KaijuAgent TargetAgent { get; set; }
Property Value
| Type | Description |
|---|---|
| KaijuAgent |
TargetComponent
The component to move in relation to.
Declaration
public Component TargetComponent { set; }
Property Value
| Type | Description |
|---|---|
| Component |
TargetGameObject
The GameObject to move in relation to.
Declaration
public GameObject TargetGameObject { get; set; }
Property Value
| Type | Description |
|---|---|
| GameObject |
TargetTransform
The transform to move in relation to.
Declaration
public Transform TargetTransform { get; set; }
Property Value
| Type | Description |
|---|---|
| Transform |
Methods
Calculate(Vector2, Single, Vector2, Single)
Calculate the movement.
Declaration
protected abstract Vector2 Calculate(Vector2 position, float speed, Vector2 target, float delta)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector2 | position | The KaijuAgent's current position. |
| System.Single | speed | The KaijuAgent's maximum movement speed. |
| Vector2 | target | The position to move in relation to. |
| System.Single | delta | The time step. |
Returns
| Type | Description |
|---|---|
| Vector2 | The calculated move vector. |
Done()
Determine if the KaijuMovement is done or not.
Declaration
public override bool Done()
Returns
| Type | Description |
|---|---|
| System.Boolean | If the KaijuMovement is done or not. |
Overrides
EditorRenderVisualizations(Vector3)
Render the visualization of the KaijuMovement. The position of the Agent.
Declaration
protected override void EditorRenderVisualizations(Vector3 position)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | position |
Overrides
Initialize(KaijuAgent, Component, Single, Single)
Initialize the KaijuMovement.
Declaration
public void Initialize(KaijuAgent agent, Component target, float distance, float weight = 1F)
Parameters
| Type | Name | Description |
|---|---|---|
| KaijuAgent | agent | The KaijuAgent this is assigned to. |
| Component | target | The component to move in relation to. |
| System.Single | distance | The distance to consider this move done. |
| System.Single | weight | The weight of this KaijuMovement. |
Initialize(KaijuAgent, GameObject, Single, Single)
Initialize the KaijuMovement.
Declaration
public void Initialize(KaijuAgent agent, GameObject target, float distance, float weight = 1F)
Parameters
| Type | Name | Description |
|---|---|---|
| KaijuAgent | agent | The KaijuAgent this is assigned to. |
| GameObject | target | The GameObject to move in relation to. |
| System.Single | distance | The distance to consider this move done. |
| System.Single | weight | The weight of this KaijuMovement. |
Initialize(KaijuAgent, Vector2, Single, Single)
Initialize the KaijuMovement.
Declaration
public void Initialize(KaijuAgent agent, Vector2 target, float distance, float weight = 1F)
Parameters
| Type | Name | Description |
|---|---|---|
| KaijuAgent | agent | The KaijuAgent this is assigned to. |
| Vector2 | target | The vector to move in relation to. |
| System.Single | distance | The distance to consider this move done. |
| System.Single | weight | The weight of this KaijuMovement. |
Initialize(KaijuAgent, Vector3, Single, Single)
Initialize the KaijuMovement.
Declaration
public void Initialize(KaijuAgent agent, Vector3 target, float distance, float weight = 1F)
Parameters
| Type | Name | Description |
|---|---|---|
| KaijuAgent | agent | The KaijuAgent this is assigned to. |
| Vector3 | target | The vector to move in relation to. |
| System.Single | distance | The distance to consider this move done. |
| System.Single | weight | The weight of this KaijuMovement. |
Move(Vector2, Single)
Get the KaijuMovement.
Declaration
public override Vector2 Move(Vector2 position, float delta)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector2 | position | The position of the Agent. |
| System.Single | delta | The time step. |
Returns
| Type | Description |
|---|---|
| Vector2 | The calculated move vector. |
Overrides
RenderDistance(Vector3)
Render the distance visualization.
Declaration
protected void RenderDistance(Vector3 target)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | target | The target position. |
Reset()
Perform any needed reset operations.
Declaration
protected override void Reset()
Overrides
Operators
Implicit(KaijuTargetMovement to GameObject)
Implicit conversion to a GameObject from the target.
Declaration
public static implicit operator GameObject(KaijuTargetMovement t)
Parameters
| Type | Name | Description |
|---|---|---|
| KaijuTargetMovement | t | The target movement. |
Returns
| Type | Description |
|---|---|
| GameObject | The target GameObject. |
Implicit(KaijuTargetMovement to KaijuAgent)
Implicit conversion to a KaijuAgent from the target.
Declaration
public static implicit operator KaijuAgent(KaijuTargetMovement t)
Parameters
| Type | Name | Description |
|---|---|---|
| KaijuTargetMovement | t | The target movement. |
Returns
| Type | Description |
|---|---|
| KaijuAgent | The target KaijuAgent from the target. |
Implicit(KaijuTargetMovement to Nullable<Vector2>)
Implicit conversion to a nullable Vector2 from the target.
Declaration
public static implicit operator Vector2? (KaijuTargetMovement t)
Parameters
| Type | Name | Description |
|---|---|---|
| KaijuTargetMovement | t | The target movement. |
Returns
| Type | Description |
|---|---|
| System.Nullable<Vector2> | The target. |
Implicit(KaijuTargetMovement to Nullable<Vector3>)
Implicit conversion to a nullable Vector3 from the target.
Declaration
public static implicit operator Vector3? (KaijuTargetMovement t)
Parameters
| Type | Name | Description |
|---|---|---|
| KaijuTargetMovement | t | The target movement. |
Returns
| Type | Description |
|---|---|
| System.Nullable<Vector3> | The target. |
Implicit(KaijuTargetMovement to Transform)
Implicit conversion to a transform from the target.
Declaration
public static implicit operator Transform(KaijuTargetMovement t)
Parameters
| Type | Name | Description |
|---|---|---|
| KaijuTargetMovement | t | The target movement. |
Returns
| Type | Description |
|---|---|
| Transform | The target transform. |
Implicit(KaijuTargetMovement to Vector2)
Implicit conversion to a Vector2 from the target.
Declaration
public static implicit operator Vector2(KaijuTargetMovement t)
Parameters
| Type | Name | Description |
|---|---|---|
| KaijuTargetMovement | t | The target movement. |
Returns
| Type | Description |
|---|---|
| Vector2 | The target. |
Implicit(KaijuTargetMovement to Vector3)
Implicit conversion to a Vector3 from the target.
Declaration
public static implicit operator Vector3(KaijuTargetMovement t)
Parameters
| Type | Name | Description |
|---|---|---|
| KaijuTargetMovement | t | The target movement. |
Returns
| Type | Description |
|---|---|
| Vector3 | The target. |