CombatState
A class in Root.Township, Alta.PlayerStates.
The player state while fighting, a sub-state of playing. Ends by itself after a timer that resets whenever the player is in combat again; shows a combat shell on clients.
- Listed in Players and characters
- Inherits or implements
PlayerStateBase<PlayingState> - Derived types
CombatToCombatTransition,ToCombatTransition<TFrom> - Documented in Player states
Constructors
| Member | What it is |
|---|---|
CombatState(PlayingState playingState) | Creates a CombatState from playingState. |
Fields
3 private and internal fields
| Member | What it is |
|---|---|
private float currentOutOfCombatTimer | Seconds left until the player leaves combat. Reset by hits and saved to disk. |
private AltaCoroutine getOutOfCombatCoroutine | The running GetOutOfCombat coroutine. |
private static Logger logger | Class logger. |
Properties
| Member | What it is |
|---|---|
override string Name { get; set; } | "Combat State". |
CombatStateSettings Settings { get; } | The combat state's settings (timer, distance curve, shell, cripple stat). |
override PlayerStateType StateType { get; } | PlayerStateType.Combat. |
Methods
| Member | What it is |
|---|---|
void ResetCurrentCombatTimer(float distanceSquared) | Restarts the out of combat timer, scaled by a curve over how far apart the fighters are. |
override void SerializeDisk(Stream stream) | Saves and loads the time left on the out of combat timer. |
override bool ValidateStateActivation(bool isDuringLoading) | Refuses to start combat while the player is loading. |
protected override void OnActivate() | Server: allows combat to combat transitions and starts the out of combat timer. |
protected override void OnActivateRemote(bool isPlayerCharacterSpawned) | Client: shows the combat shell and, for the local player, plays the enter combat sound. |
protected override void OnDeactivate() | Server: clears the locomotion cooldown, refills the cripple stat and stops the timer. |
protected override void OnDeactivateRemote(bool isPlayerCharacterSpawned) | Client: hides the combat shell (if alive) and plays the wave effect. |