Skip to main content

Signal

A small data-structure representing an object that is detected.

Properties

Object

The GameObject that this signal is associated with.

Strength

The visibility of the signal. In the future this may be treated more abstractly, for example the Steering Sensor may prioritise avoiding signals with higher Strength. Right now it's just visibility generated by LOS Sensor. All other sensors set it to 1.

Shape

A Bounds that approximates the shape of the object. This is in local coordinates to the Object.

Bounds

Get or set the Shape in world coordinates.

Constructors

Signal(obj, strength, shape)

Signal(GameObject obj, float strength, Bounds shape)
Creates a Signal with specified Object, Strength and Shape.

Signal(obj)

Signal(GameObject obj)
Creates a Signal with specified Object. The Strength will be 1 and the Shape will be a zero size Bounds centered at the Objects position.

Methods

Expand(collider)

void Expand(Collider c)
Expands this signals Bounds to encapsulate the the bounds of the collider.

Combine(signal)

void Combine(Signal signal)
This signal is combined with another. The resulting Strength is the maximum of either signal. The resulting Shape encapsulates the Shapes of both.