Loading...
Searching...
No Matches
AdventureCore.AttributePoolSurrogate Class Reference

Detailed Description

placeholder that redirects to an actual component when a character with a specified id is available
can be used to bind things like UI to components of characters that will spawn during gameplay

https://adventure.softleitner.com/manual/attribute

Inheritance diagram for AdventureCore.AttributePoolSurrogate:
AdventureCore.AttributePool

Public Member Functions

override void Add (AttributeType type, int quantity)
 adds to the value of an attribute
 
override void Remove (AttributeType type, int quantity)
 removes from the value of an attribute
 
override bool HasValue (AttributeValue attributeValue)
 checks if the current value of an attribute is at least as large as the one passed
 
override bool HasValues (IEnumerable< AttributeValue > attributeValues)
 
override bool HasValue (AttributeStatValue attributeStatValue)
 
override bool HasValues (IEnumerable< AttributeStatValue > attributeStatValues)
 
override IEnumerable< AttributeValueGetValues ()
 
override int GetValue (AttributeType attribute)
 applies all modifiers and returns the attribute value
 
override int GetRawValue (AttributeType attribute)
 returns the attribute value without modifiers
 
override int GetValue (AttributeStat stat)
 applies all modifiers and returns the stat value
 
override void AddObserver (AttributeType attribute, Action< int > callback)
 add a callback that will be called whenever an attribute changes
changes can occur when the value changes or modifiers are added or removed
 
override void RemoveObserver (AttributeType attribute, Action< int > callback)
 removes an observing action that was added in AddObserver(AttributeType, Action<int>)
 
override void AddObserver (AttributeStat stat, Action< int > callback)
 add a callback that will be called whenever a stat changes
changes can occur when the attribute changes or modifiers are added or removed
 
override void RemoveObserver (AttributeStat stat, Action< int > callback)
 removes an observing action that was added in AddObserver(AttributeStat, Action<int>)
 
override void AddModifier (IAttributeModifier attributeModifier)
 adds a modifier for attributes, observers will be notified
 
override void RemoveModifier (IAttributeModifier attributeModifier)
 removes a modifier for attributes, observers will be notified
 
override void AddModifier (IStatModifier statModifier)
 adds a modifier for stats, observers will be notified
 
override void RemoveModifier (IStatModifier statModifier)
 removes a modifier for stats, observers will be notified
 
override AttributeData GetData ()
 collects all the state from attributes and puts it into a AttributeData that can be serialized
may be used from outside when attributedata is put into a larger structure that is persisted and no persister is set up here
 
override void Persist ()
 
- Public Member Functions inherited from AdventureCore.AttributePool
void Initialize ()
 
virtual void Set (AttributeType type, int quantity)
 sets value of an attribute
 
void Retrieve ()
 

Public Attributes

string CharacterId
 
- Public Attributes inherited from AdventureCore.AttributePool
PersisterBase Persister
 
AttributeValue[] Attributes
 
AttributeStatValue[] BaseStats
 
ResourceMaximum[] ResourceMaximums
 
UnityEvent< AttributeType, int > AttributeChanged
 

Additional Inherited Members

- Static Public Attributes inherited from AdventureCore.AttributePool
const string PERSISTENCE_SUB_KEY = "ATT"
 
- Properties inherited from AdventureCore.AttributePool
bool IsInitialized [get]
 

Member Function Documentation

◆ Add()

override void AdventureCore.AttributePoolSurrogate.Add ( AttributeType type,
int quantity )
virtual

adds to the value of an attribute

Parameters
type
quantity

Reimplemented from AdventureCore.AttributePool.

◆ AddModifier() [1/2]

override void AdventureCore.AttributePoolSurrogate.AddModifier ( IAttributeModifier attributeModifier)
virtual

adds a modifier for attributes, observers will be notified

Parameters
attributeModifier

Reimplemented from AdventureCore.AttributePool.

◆ AddModifier() [2/2]

override void AdventureCore.AttributePoolSurrogate.AddModifier ( IStatModifier statModifier)
virtual

adds a modifier for stats, observers will be notified

Parameters
statModifier

Reimplemented from AdventureCore.AttributePool.

◆ AddObserver() [1/2]

override void AdventureCore.AttributePoolSurrogate.AddObserver ( AttributeStat stat,
Action< int > callback )
inlinevirtual

add a callback that will be called whenever a stat changes
changes can occur when the attribute changes or modifiers are added or removed

Parameters
attribute
callback

Reimplemented from AdventureCore.AttributePool.

◆ AddObserver() [2/2]

override void AdventureCore.AttributePoolSurrogate.AddObserver ( AttributeType attribute,
Action< int > callback )
inlinevirtual

add a callback that will be called whenever an attribute changes
changes can occur when the value changes or modifiers are added or removed

Parameters
attribute
callback

Reimplemented from AdventureCore.AttributePool.

◆ GetData()

override AttributeData AdventureCore.AttributePoolSurrogate.GetData ( )
virtual

collects all the state from attributes and puts it into a AttributeData that can be serialized
may be used from outside when attributedata is put into a larger structure that is persisted and no persister is set up here

Returns

Reimplemented from AdventureCore.AttributePool.

◆ GetRawValue()

override int AdventureCore.AttributePoolSurrogate.GetRawValue ( AttributeType attribute)
virtual

returns the attribute value without modifiers

Parameters
attribute
Returns
current value of the attribute

Reimplemented from AdventureCore.AttributePool.

◆ GetValue() [1/2]

override int AdventureCore.AttributePoolSurrogate.GetValue ( AttributeStat stat)
virtual

applies all modifiers and returns the stat value

Parameters
attribute
Returns
current value of the stat

Reimplemented from AdventureCore.AttributePool.

◆ GetValue() [2/2]

override int AdventureCore.AttributePoolSurrogate.GetValue ( AttributeType attribute)
virtual

applies all modifiers and returns the attribute value

Parameters
attribute
Returns
current value of the attribute

Reimplemented from AdventureCore.AttributePool.

◆ GetValues()

override IEnumerable< AttributeValue > AdventureCore.AttributePoolSurrogate.GetValues ( )
virtual

Reimplemented from AdventureCore.AttributePool.

◆ HasValue() [1/2]

override bool AdventureCore.AttributePoolSurrogate.HasValue ( AttributeStatValue attributeStatValue)
virtual

Reimplemented from AdventureCore.AttributePool.

◆ HasValue() [2/2]

override bool AdventureCore.AttributePoolSurrogate.HasValue ( AttributeValue attributeValue)
virtual

checks if the current value of an attribute is at least as large as the one passed

Parameters
attributeValue
Returns
if current >= passed value

Reimplemented from AdventureCore.AttributePool.

◆ HasValues() [1/2]

override bool AdventureCore.AttributePoolSurrogate.HasValues ( IEnumerable< AttributeStatValue > attributeStatValues)
virtual

Reimplemented from AdventureCore.AttributePool.

◆ HasValues() [2/2]

override bool AdventureCore.AttributePoolSurrogate.HasValues ( IEnumerable< AttributeValue > attributeValues)
virtual

Reimplemented from AdventureCore.AttributePool.

◆ Persist()

override void AdventureCore.AttributePoolSurrogate.Persist ( )
virtual

Reimplemented from AdventureCore.AttributePool.

◆ Remove()

override void AdventureCore.AttributePoolSurrogate.Remove ( AttributeType type,
int quantity )
virtual

removes from the value of an attribute

Parameters
type
quantity

Reimplemented from AdventureCore.AttributePool.

◆ RemoveModifier() [1/2]

override void AdventureCore.AttributePoolSurrogate.RemoveModifier ( IAttributeModifier attributeModifier)
virtual

removes a modifier for attributes, observers will be notified

Parameters
attributeModifier

Reimplemented from AdventureCore.AttributePool.

◆ RemoveModifier() [2/2]

override void AdventureCore.AttributePoolSurrogate.RemoveModifier ( IStatModifier statModifier)
virtual

removes a modifier for stats, observers will be notified

Parameters
statModifier

Reimplemented from AdventureCore.AttributePool.

◆ RemoveObserver() [1/2]

override void AdventureCore.AttributePoolSurrogate.RemoveObserver ( AttributeStat stat,
Action< int > callback )
inlinevirtual

removes an observing action that was added in AddObserver(AttributeStat, Action<int>)

Parameters
attribute
callback

Reimplemented from AdventureCore.AttributePool.

◆ RemoveObserver() [2/2]

override void AdventureCore.AttributePoolSurrogate.RemoveObserver ( AttributeType attribute,
Action< int > callback )
inlinevirtual

removes an observing action that was added in AddObserver(AttributeType, Action<int>)

Parameters
attribute
callback

Reimplemented from AdventureCore.AttributePool.