Skip to main content

DistanceOperation

A class in Root.Township, Alta.Intelligence.

Older prefab scoring component for the target's distance (or squared distance). In the editor it migrates itself to a SenseOperation.

Constructors​

MemberWhat it is
DistanceOperation()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

4 private and internal fields
MemberWhat it is
private float fromDistance that maps to 0.
private bool isSquaredUse the DistanceSquared sense instead of Distance.
private float multiplierWeight of the rule. Only matters for preferred rules.
private float toDistance that maps to 1 (default 1).

Methods​

MemberWhat it is
override TargetOperation GetOperation()Makes a target sense rule on the Distance or DistanceSquared sense, from from to to, weighted by multiplier.
protected override string GetName()Builds the GameObject name, like Distance 0 -> 1 (x1).
protected override void OnValidate()Editor: renames the GameObject and migrates the settings to a SenseOperation (or OldSenseOperation).