Class KaijuVisionSensor<T>
KaijuSensor to allow for visual detection of a component type.
Inheritance
Inherited Members
Namespace: KaijuSolutions.Agents.Sensors
Syntax
public abstract class KaijuVisionSensor<T> : KaijuSensor where T : Component
Type Parameters
| Name | Description |
|---|---|
| T | The type of component. |
Fields
editorColor
The visualizations color in the editor.
Declaration
public Color editorColor
Field Value
| Type | Description |
|---|---|
| Color |
editorFromAgent
If the visualizations in the editor for the line-of-sight checks should come from the Agent's position or from the KaijuSensor's position. The range and view arc are always drawn from the Agent's Y height and the KaijuSensor's X and Z positions.
Declaration
public bool editorFromAgent
Field Value
| Type | Description |
|---|---|
| System.Boolean |
lineOfSight
If line-of-sight checks should be made for the vision. Turning off line-of-sight checks will return items within the view arc based on the angle and distance.
Declaration
public bool lineOfSight
Field Value
| Type | Description |
|---|---|
| System.Boolean |
mask
What layers to collide with on the line-of-sight checks.
Declaration
public LayerMask mask
Field Value
| Type | Description |
|---|---|
| LayerMask |
Observables
The objects which this can detect.
Declaration
public IEnumerable<T> Observables
Field Value
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<T> |
offset
Any vertical offset to add to the line-of-sight checks. This can be useful if you for instance have targets which are a few units high but their origins are at their bases.
Declaration
public float offset
Field Value
| Type | Description |
|---|---|
| System.Single |
triggers
How line-of-sight checks should handle hitting triggers.
Declaration
public QueryTriggerInteraction triggers
Field Value
| Type | Description |
|---|---|
| QueryTriggerInteraction |
Properties
Angle
What angle the vision detection should cover.
Declaration
public float Angle { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Single |
Distance
How far vision can extend.
Declaration
public float Distance { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Single |
Observed
All observed items.
Declaration
public IReadOnlyCollection<T> Observed { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IReadOnlyCollection<T> |
ObservedCount
The number of observed items.
Declaration
public int ObservedCount { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
Radius
The radius of the line-of-sight checks.
Declaration
public float Radius { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Single |
Methods
Cleanup()
Perform any needed resetting of the KaijuSensor.
Declaration
protected override void Cleanup()
Overrides
DefaultObservables()
If there are no explicitly defined observable objects, define how to query for default observables.
Declaration
protected virtual IEnumerable<T> DefaultObservables()
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<T> | All active instances. |
EditorVisualize(Vector3)
Allow for visualizing in the editor. The position of the Agent.
Declaration
public override void EditorVisualize(Vector3 position)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | position |
Overrides
Run()
Run the KaijuSensor.
Declaration
protected override void Run()
Overrides
Operators
Implicit(GameObject to KaijuVisionSensor<T>)
Implicit conversion from a GameObject.
Declaration
public static implicit operator KaijuVisionSensor<T>(GameObject o)
Parameters
| Type | Name | Description |
|---|---|---|
| GameObject | o | The GameObject. |
Returns
| Type | Description |
|---|---|
| KaijuVisionSensor<T> | The KaijuVisionSensor<T> attached to the GameObject if there was one. |
Implicit(KaijuVisionSensor<T> to KaijuAgent)
Implicit conversion to a KaijuAgent.
Declaration
public static implicit operator KaijuAgent(KaijuVisionSensor<T> s)
Parameters
| Type | Name | Description |
|---|---|---|
| KaijuVisionSensor<T> | s | The KaijuVisionSensor<T>. |
Returns
| Type | Description |
|---|---|
| KaijuAgent | The KaijuAgent attached to the KaijuVisionSensor<T> if there was one. |
Implicit(Transform to KaijuVisionSensor<T>)
Implicit conversion from a transform.
Declaration
public static implicit operator KaijuVisionSensor<T>(Transform t)
Parameters
| Type | Name | Description |
|---|---|---|
| Transform | t | The transform. |
Returns
| Type | Description |
|---|---|
| KaijuVisionSensor<T> | The KaijuVisionSensor<T> attached to the transform if there was one. |