Interface ICharacterAttributeController
Interface for character attribute controllers, providing access and management for all character attributes and resources. Used to read, modify, and synchronize attribute and resource values for a character.
public interface ICharacterAttributeController : ICharacterBehaviour
- Inherited Members
- Extension Methods
Properties
Attributes
Dictionary of all non-resource character attributes, keyed by template ID.
Dictionary<int, CharacterAttribute> Attributes { get; }
Property Value
IsPropagating
True while the attribute graph is propagating value changes. Notifications are deferred until propagation completes.
bool IsPropagating { get; }
Property Value
ResourceAttributes
Dictionary of all resource character attributes (e.g., health, mana), keyed by template ID.
Dictionary<int, CharacterResourceAttribute> ResourceAttributes { get; }
Property Value
Methods
AddAttribute(CharacterAttribute)
Adds a new non-resource attribute instance to the controller.
void AddAttribute(CharacterAttribute instance)
Parameters
instanceCharacterAttributeAttribute instance to add.
ApplyResourceState(CharacterAttributeResourceState)
Applies a resource state (health, mana, stamina, regen delta) to the controller.
void ApplyResourceState(CharacterAttributeResourceState resourceState)
Parameters
resourceStateCharacterAttributeResourceStateResource state to apply.
BeginNotificationSuppression()
Begins a scope that suppresses all attribute update notifications while still allowing deterministic attribute/resource state mutations to run. Used by prediction replay so UI, ECA, and passive listeners do not observe intermediate resimulation states.
void BeginNotificationSuppression()
BeginPropagation()
Begins a propagation batch. While active, EnqueueNotification(CharacterAttribute) collects changed attributes instead of firing events immediately. Must be paired with EndPropagation().
void BeginPropagation()
ClearModifierSource(ModifierSource)
Releases one contributor from every attribute on the sheet.
void ClearModifierSource(ModifierSource source)
Parameters
sourceModifierSourceThe contributor to release everywhere.
Remarks
For a source whose owner goes away without knowing which attributes it touched — see
Region, which releases its own contributions when a character leaves it.
EndNotificationSuppression()
Ends a notification-suppression scope and discards any queued updates without invoking OnAttributeUpdated listeners.
void EndNotificationSuppression()
EndPropagation()
Ends a propagation batch. If this is the outermost batch (depth returns to zero), fires all deferred OnAttributeUpdated events.
void EndPropagation()
EnqueueNotification(CharacterAttribute)
Enqueues an attribute for deferred notification during propagation. If not propagating, callers should invoke the event directly instead.
void EnqueueNotification(CharacterAttribute attribute)
Parameters
attributeCharacterAttributeThe attribute to notify after propagation completes.
GetResourceState()
Gets the current resource state (health, mana, stamina, regen delta) for the controller.
CharacterAttributeResourceState GetResourceState()
Returns
- CharacterAttributeResourceState
Current resource state struct.
Regenerate(uint)
Advances tick-driven regen for resource attributes (e.g., health, mana).
A pulse fires when tick % regenTickInterval == 0; an internal
monotonic guard prevents double-advancement under replay, resimulation,
or future-state execution.
void Regenerate(uint tick)
Parameters
tickuintAuthoritative simulation tick for this replicate step.
SetAttribute(int, int, int?)
Sets the value and optional modifier of a non-resource attribute by template ID.
void SetAttribute(int id, int value, int? modifier = null)
Parameters
idintTemplate ID of the attribute.
valueintNew value to set.
modifierint?Optional modifier value to set.
SetResourceAttribute(int, int, float, int?)
Sets the value, current value, and optional modifier of a resource attribute by template ID.
void SetResourceAttribute(int id, int value, float currentValue, int? modifier = null)
Parameters
idintTemplate ID of the resource attribute.
valueintNew value to set.
currentValuefloatNew current value to set.
modifierint?Optional modifier value to set.
TryGetAttribute(CharacterAttributeTemplate, out CharacterAttribute)
Tries to get a non-resource attribute by template reference.
bool TryGetAttribute(CharacterAttributeTemplate template, out CharacterAttribute attribute)
Parameters
templateCharacterAttributeTemplateAttribute template to look up.
attributeCharacterAttributeOut: found attribute instance.
Returns
- bool
True if found, false otherwise.
TryGetAttribute(int, out CharacterAttribute)
Tries to get a non-resource attribute by template ID.
bool TryGetAttribute(int id, out CharacterAttribute attribute)
Parameters
idintTemplate ID to look up.
attributeCharacterAttributeOut: found attribute instance.
Returns
- bool
True if found, false otherwise.
TryGetHealthAttribute(out CharacterResourceAttribute)
Tries to get the health resource attribute for the character.
bool TryGetHealthAttribute(out CharacterResourceAttribute health)
Parameters
healthCharacterResourceAttributeOut: found health resource attribute.
Returns
- bool
True if found, false otherwise.
TryGetManaAttribute(out CharacterResourceAttribute)
Tries to get the mana resource attribute for the character.
bool TryGetManaAttribute(out CharacterResourceAttribute mana)
Parameters
manaCharacterResourceAttributeOut: found mana resource attribute.
Returns
- bool
True if found, false otherwise.
TryGetResourceAttribute(CharacterAttributeTemplate, out CharacterResourceAttribute)
Tries to get a resource attribute by template reference.
bool TryGetResourceAttribute(CharacterAttributeTemplate template, out CharacterResourceAttribute attribute)
Parameters
templateCharacterAttributeTemplateResource attribute template to look up.
attributeCharacterResourceAttributeOut: found resource attribute instance.
Returns
- bool
True if found, false otherwise.
TryGetResourceAttribute(int, out CharacterResourceAttribute)
Tries to get a resource attribute by template ID.
bool TryGetResourceAttribute(int id, out CharacterResourceAttribute attribute)
Parameters
idintTemplate ID to look up.
attributeCharacterResourceAttributeOut: found resource attribute instance.
Returns
- bool
True if found, false otherwise.
TryGetStaminaAttribute(out CharacterResourceAttribute)
Tries to get the stamina resource attribute for the character.
bool TryGetStaminaAttribute(out CharacterResourceAttribute stamina)
Parameters
staminaCharacterResourceAttributeOut: found stamina resource attribute.
Returns
- bool
True if found, false otherwise.