Class ClickPicking

Namespace
TDMaker.Unity.Hud
Assembly
TDMaker.Unity.dll

Battlefield click-target rules used by GameHud (input grammar, spec 14 ยง1): every clickable thing has an axis-aligned world rectangle placed relative to its reference point; a click hits it only strictly inside (the border is excluded). Among the hits the higher selection priority wins, then the lower world reference point (smaller y). Equal priority and equal y keep the first candidate found.

public static class ClickPicking
Inheritance
ClickPicking
Inherited Members

Fields

DefaultPriority

Default selection priority of soldiers, enemies, towers and empty build slots.

public const int DefaultPriority = 0

Field Value

int

HeroPriority

Default selection priority of heroes (above every other battlefield target).

public const int HeroPriority = 1

Field Value

int

Methods

Contains(Vector2, Vector2, Vector2, Vector2)

Whether point lies strictly inside the rectangle of size centred at reference + offset.

public static bool Contains(Vector2 reference, Vector2 size, Vector2 offset, Vector2 point)

Parameters

reference Vector2
size Vector2
offset Vector2
point Vector2

Returns

bool

IsBefore(int, float, int, float)

Whether a candidate (priority, reference y) is picked before the current best one.

public static bool IsBefore(int priority, float referenceY, int bestPriority, float bestReferenceY)

Parameters

priority int
referenceY float
bestPriority int
bestReferenceY float

Returns

bool