Player Stats

Class Overview

The PlayerStats is responsible for the player's statistical data.

Properties

  • private PlayerWorker playerWorker: References the PlayerWorker associated with PlayerStats.

  • public PlayerOnChainStats playerOnChainStats: References the on-chain stats of the player.

Constructor

  • public PlayerStats(PlayerWorker playerWorker): Initializes a new instance of the PlayerStats class, assigning the PlayerWorker. Also initializes the playerOnChainStats.

Methods

  • public void OnUpdate(): Called every frame, handles player stats update.

  • public void Regenerate(): Handles the regeneration of the player's health over time, with specific conditions based on the time of day.

  • public float CalculateNewHealth(): Calculates the new health of the player, incrementing over time.

  • public void TakeDamage(float damage): Applies damage to the player, considering the player's armor and armor bonuses, and triggers death or damage reactions accordingly.

  • public void Die(): Handles the player's death scenario.

Last updated