Class KaijuAttackActuator
Base KaijuActuator for attacking other objects. This will perform a raycast in the direction of its forward.
Inheritance
Inherited Members
Namespace: KaijuSolutions.Agents.Actuators
Syntax
public abstract class KaijuAttackActuator : KaijuActuator
Fields
checkParents
Often, a child collider may be hit. This will continue to perform the HandleHit(RaycastHit, Transform) method against all parent objects to handle this case.
Declaration
public bool checkParents
Field Value
| Type | Description |
|---|---|
| System.Boolean |
lineRenderer
The line renderer for visualizing the attacks.
Declaration
protected LineRenderer lineRenderer
Field Value
| Type | Description |
|---|---|
| LineRenderer |
mask
The layers to use for ray casting.
Declaration
public LayerMask mask
Field Value
| Type | Description |
|---|---|
| LayerMask |
triggers
How string-pulling should consider triggers.
Declaration
public QueryTriggerInteraction triggers
Field Value
| Type | Description |
|---|---|
| QueryTriggerInteraction |
Properties
Charge
The time it takes to charge the attack in seconds before it is performed.
Declaration
public float Charge { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Single |
Cooldown
The time it takes to cooldown after the attack in seconds before it can be performed again.
Declaration
public float Cooldown { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Single |
LastPoint
The last point which was hit. Note if currently charging an attack, this will still be the previously hit target.
Declaration
public Vector3? LastPoint { get; }
Property Value
| Type | Description |
|---|---|
| System.Nullable<Vector3> |
LastTarget
The last object which was hit. Note if currently charging an attack, this will still be the previously hit target.
Declaration
public Transform LastTarget { get; }
Property Value
| Type | Description |
|---|---|
| Transform |
OnCooldown
If this attack actuator is currently cooling down.
Declaration
public bool OnCooldown { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Range
The range of the attack.
Declaration
public float Range { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Single |
Visible
How long the lineRenderer should be visible in seconds.
Declaration
public float Visible { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Single |
Methods
Cleanup()
Perform any needed resetting of the KaijuActuator.
Declaration
protected override void Cleanup()
Overrides
HandleHit(RaycastHit, Transform)
Handle the hit logic.
Declaration
protected abstract bool HandleHit(RaycastHit hit, Transform t)
Parameters
| Type | Name | Description |
|---|---|---|
| RaycastHit | hit | The hit details. |
| Transform | t | The transform currently being checked. This may not be the same as the one in the hit parameter in the case of checking parents. |
Returns
| Type | Description |
|---|---|
| System.Boolean | If the attack was a success or not. |
PostActions(Boolean)
Any final actions to perform after the actuator has performed.
Declaration
protected virtual void PostActions(bool success)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | success | If it succeeded or not. |
PreConditions()
Any conditions which must be passed to begin running the actuator. This does not need to account for the Charge or Cooldown.
Declaration
protected virtual bool PreConditions()
Returns
| Type | Description |
|---|---|
| System.Boolean | If the conditions to run this were passed. |
Run()
Run the KaijuActuator.
Declaration
protected override KaijuActuatorState Run()
Returns
| Type | Description |
|---|---|
| KaijuActuatorState | The state of the KaijuActuator's progress. |
Overrides
Operators
Implicit(GameObject to KaijuAttackActuator)
Implicit conversion from a GameObject.
Declaration
public static implicit operator KaijuAttackActuator(GameObject o)
Parameters
| Type | Name | Description |
|---|---|---|
| GameObject | o | The GameObject. |
Returns
| Type | Description |
|---|---|
| KaijuAttackActuator | The attack actuator attached to the GameObject if there was one. |
Implicit(KaijuAttackActuator to KaijuAgent)
Implicit conversion to a KaijuAgent.
Declaration
public static implicit operator KaijuAgent(KaijuAttackActuator s)
Parameters
| Type | Name | Description |
|---|---|---|
| KaijuAttackActuator | s | The attack actuator. |
Returns
| Type | Description |
|---|---|
| KaijuAgent | The KaijuAgent attached to the attack actuator if there was one. |
Implicit(Transform to KaijuAttackActuator)
Implicit conversion from a transform.
Declaration
public static implicit operator KaijuAttackActuator(Transform t)
Parameters
| Type | Name | Description |
|---|---|---|
| Transform | t | The transform. |
Returns
| Type | Description |
|---|---|
| KaijuAttackActuator | The attack actuator attached to the transform if there was one. |