Skip to main content

ToCombatTransition<TFrom>

A class in Root.Township, Alta.PlayerStates.Transitions.

Transition into the combat state. Fires when the player is hurt by a tool within combat range, or when the player causes combat.

Constructors​

MemberWhat it is
ToCombatTransition()Creates a ToCombatTransition with default values.

Properties​

1 private and internal property
MemberWhat it is
private CombatStateSettings CombatSettings { get; }The CombatStateSettings asset, used for the max combat distance.

Methods​

MemberWhat it is
protected override void AddListeners()Hooks the player's health changes and caused-combat events.
protected override void RemoveListeners()Unhooks the health and caused-combat events.
2 private and internal methods
MemberWhat it is
private void CheckEnterCombat(HealthObject healthObject, float healthChange, DamageData impact)On tool damage while still alive, enters combat if the attacker is in range, resets the combat timer and tells the attacker it caused combat. Ignores self-hits.
private void HandleCausedCombat(PlayerController attacker, NetworkEntity attackee, float distanceBetweenCombatantsSquared, float damage)Enters combat when this player attacks someone, resetting the combat timer by distance.