Class IsWithinFacingAngleCondition
Passes when the evaluated character lies within an arc of the initiator's facing — a "must be in front of you" gate, or with Invert, a backstab gate.
[Serializable]
public class IsWithinFacingAngleCondition : BaseCondition, ICondition
- Inheritance
-
IsWithinFacingAngleCondition
- Implements
- Inherited Members
Remarks
Position-sensitive in the same way WithinRangeCondition is, with one extra term: it also depends on the initiator's ROTATION, which a client changes far faster than it changes position. A tight arc is therefore much more latency-sensitive than a tight radius — a player spinning at 180 degrees a second sweeps a 45 degree arc past a target in a quarter of a second, well inside a high-latency round trip. Prefer wide arcs, and treat a narrow one as a design decision about feel rather than a precision instrument.
Measured against the initiator's transform forward on the horizontal plane. Height is ignored deliberately: a target directly above or below is at an extreme vertical angle but is not "behind" you in any sense an author means.
Fields
ArcDegrees
Total width of the arc in degrees, centred on the initiator's forward.
[Tooltip("Total arc width in degrees, centred on forward. 90 allows 45 degrees to each side.")]
[Range(0, 360)]
public float ArcDegrees
Field Value
Remarks
The FULL angle, not the half angle: 90 means 45 degrees to each side. Authors read a cone as its total spread, and halving it here rather than at the call site is what stops the same number meaning two things in two places. 360 or more always passes.
Methods
Evaluate(ICharacter, EventData)
Evaluates the condition's raw pass/fail logic. Must be implemented by derived classes. Derived classes should NOT apply Invert themselves — the framework calls Check(ICharacter, EventData), which wraps this method and applies Invert uniformly.
public override bool Evaluate(ICharacter initiator, EventData eventData)
Parameters
initiatorICharacterThe character initiating the check.
eventDataEventDataOptional event data for the condition.
Returns
- bool
True if the underlying check passes; otherwise, false.