Class SoSetScalingComponentBase<SetType, KeyType>
- Namespace
- ElectricDrill.SoapRpgFramework.Scaling
- Assembly
- com.electricdrill.soap-rpg-framework.Runtime.dll
Abstract base class for scaling components that work with ScriptableObject-based sets.
public abstract class SoSetScalingComponentBase<SetType, KeyType> : ScalingComponent, IValueProvider<KeyType, double> where SetType : ScriptableObject
Type Parameters
SetTypeThe type of ScriptableObject set that contains the items used for defining the scaling value
KeyTypeThe type of items within the set that can be used to calculate the scaling value
- Inheritance
-
objectSoSetScalingComponentBase<SetType, KeyType>
- Implements
-
IValueProvider<KeyType, double>
- Derived
Fields
_set
[SerializeField]
protected SetType _set
Field Value
- SetType
Properties
Set
The base set used for scaling calculations.
public SetType Set { get; }
Property Value
- SetType
Methods
CalculateValue(EntityCore)
Calculates the final scaled value based on the entity's values and the configured scaling multipliers.
public override long CalculateValue(EntityCore entity)
Parameters
entityEntityCoreThe entity to calculate the scaled value for
Returns
- long
The calculated scaled value as a long integer
Get(KeyType)
Gets the value associated with the specified key.
public virtual double Get(KeyType key)
Parameters
keyKeyTypeThe key used to retrieve the value.
Returns
- double
The value associated with the specified key.
GetEntitySet(EntityCore)
Gets the set associated with the specified entity. This method must be implemented by derived classes to define how to retrieve the entity's set.
protected abstract SetType GetEntitySet(EntityCore entity)
Parameters
entityEntityCoreThe entity to get the set for
Returns
- SetType
The set associated with the entity
GetEntityValue(EntityCore, KeyType)
Gets the current value of a specific key for the given entity. This method must be implemented by derived classes to define how to retrieve entity values.
protected abstract long GetEntityValue(EntityCore entity, KeyType key)
Parameters
entityEntityCoreThe entity to get the value from
keyKeyTypeThe specific key to get the value for
Returns
- long
The current value of the specified key for the entity
GetSetItems()
Gets all items from the current set that can be used for scaling. This method must be implemented by derived classes to define which items are available for scaling.
protected abstract IEnumerable<KeyType> GetSetItems()
Returns
- IEnumerable<KeyType>
An enumerable collection of all scalable items in the set
OnValidate()
Validates and refreshes the scaling attribute values based on the current set. Called automatically when the component is validated in the editor.
protected virtual void OnValidate()
ValidateEntitySet(EntityCore)
Validates that the entity's set is compatible with this scaling component's set. By default, requires exact equality. Derived classes can override for different validation logic.
protected virtual void ValidateEntitySet(EntityCore entity)
Parameters
entityEntityCoreThe entity to validate