Skip to main content

HumanPlayerActor

The HumanPlayerActor class extends the abstract PlayerActor, implementing a standard human-controlled character with health management, dialog handling, and state machine initialization.

public class HumanPlayerActor : PlayerActor

🧬 Inherited Systems

This class inherits the full suite of systems from PlayerActor, including:

  • Interaction handling
  • Avatar and visual management
  • Network spawning/despawning
  • Camera control
  • State machines for main and hand behaviors

❤️ Health System

int Health (Networked)

Type: int
Default: 100
Tracks the current health of the actor.

int MaxHealth (Networked)

Type: int
Default: 100
Defines the upper limit of the actor's health.

UseHealth(int amount)

Reduces health by a given amount. If health drops to 0 or less, the actor dies (future extension).

GetHealth(), SetHealth(int), GetMaxHealth()

Provides accessors for current and max health values.


🗣 Dialog Handling

CanEnterDialog()

Returns true if the actor is not already in a dialog.

EnterDialogState(DialogStateMachine)

Transitions into a dialog state by setting _currentDialog and invoking its entry logic.


🎭 State Machines

StateMachinesInitialized()

Automatically activates idle states for both primary and secondary machines after spawn.

GetMainStateMachine()?.ForceActivateState<IdleBehaviour>();
GetSecondaryStateMachine()?.ForceActivateState<HandsIdleBehaviour>();

State Machine Accessors

  • GetMainStateMachine()
  • GetSecondaryStateMachine()

🌱 Summary

HumanPlayerActor is the concrete, player-controllable implementation of the core PlayerActor logic. It adds basic health, idle state defaults, and dialog capabilities, acting as a template for other humanoid avatars or roles in the game.