CharacterAttributeResourceState - jimdroberts/FishMMO GitHub Wiki

Description

Represents the current state of a character's resource attributes (health, mana, stamina) and regeneration timer. Used for synchronizing resource values and regeneration progress between client and server in the FishMMO system.


API Access

Fields

  • public float RegenDelta

    The accumulated time delta for resource regeneration ticks. Used to track partial intervals between regeneration updates.

  • public float Health

    The current health value of the character.

  • public float Mana

    The current mana value of the character.

  • public float Stamina

    The current stamina value of the character.


Basic Usage

Setup

  1. Use CharacterAttributeResourceState to store and transfer resource values and regeneration state.
  2. Assign values to RegenDelta, Health, Mana, and Stamina as needed for synchronization.

Example

// Example 1: Creating and assigning a resource state
CharacterAttributeResourceState state = new CharacterAttributeResourceState {
    RegenDelta = 2.5f,
    Health = 100f,
    Mana = 50f,
    Stamina = 75f
};

// Example 2: Applying a resource state to a character
characterAttributeController.ApplyResourceState(state);

Best Practices

  • Use this struct to efficiently synchronize resource values between client and server.
  • Track RegenDelta to ensure smooth and accurate regeneration updates.
  • Assign all fields explicitly to avoid uninitialized values.
⚠️ **GitHub.com Fallback** ⚠️