CharacterAttributeResourceState - jimdroberts/FishMMO GitHub Wiki
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.
-
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.
- Use CharacterAttributeResourceState to store and transfer resource values and regeneration state.
- Assign values to RegenDelta, Health, Mana, and Stamina as needed for synchronization.
// 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);
- 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.