Class ExpCollectionStrategySO
- Namespace
- ElectricDrill.AstraHealth.Experience
- Assembly
- com.electricdrill.astra-health.Runtime.dll
Abstract base class for experience collection strategies. Implements the Template Method pattern to define when and how experience should be collected. Derive from this class to create custom experience collection logic.
public abstract class ExpCollectionStrategySO : ScriptableObject, ITaggable
- Inheritance
-
objectExpCollectionStrategySO
- Implements
-
ITaggable
- Derived
Properties
Tags
The tags associated with this object.
public GameTagSet Tags { get; }
Property Value
- GameTagSet
Methods
CalculateExpAmount(IExpSource, float)
Calculates the final experience amount to collect based on the source and multiplier. Override this method to customize experience calculation logic.
protected virtual long CalculateExpAmount(IExpSource expSource, float multiplier)
Parameters
expSourceIExpSourceThe experience source providing the base amount.
multiplierfloatThe multiplier to apply to the base experience.
Returns
- long
The final experience amount to add.
CollectExp(EntityCore, IExpSource, float)
Performs the actual experience collection: calculates the amount, adds it to the collector's level, and marks the source as harvested. Override this method to customize the entire collection process (e.g., for party XP sharing).
protected virtual bool CollectExp(EntityCore collector, IExpSource expSource, float multiplier)
Parameters
collectorEntityCoreThe entity collecting the experience.
expSourceIExpSourceThe experience source to collect from.
multiplierfloatThe multiplier to apply to the base experience.
Returns
- bool
True if experience was collected, false otherwise.
TryCollectExp(EntityCore, EntityCore, DamageResolutionContext)
Attempts to collect experience from a victim entity and add it to the collector's level. This is the main public interface for experience collection. Handles validation, extraction of IExpSource, calculation, adding to EntityLevel, and marking as harvested.
public virtual bool TryCollectExp(EntityCore collector, EntityCore victim, DamageResolutionContext dmgResolutionContext)
Parameters
collectorEntityCoreThe entity attempting to collect experience.
victimEntityCoreThe entity that died and may provide experience.
dmgResolutionContextDamageResolutionContextThe damage resolution that caused the death.
Returns
- bool
True if experience was successfully collected, false otherwise.
TryGetExpSource(EntityCore, out IExpSource)
Attempts to extract an IExpSource from the victim's EntityCore. Override this method to customize how the IExpSource is retrieved.
protected virtual bool TryGetExpSource(EntityCore victim, out IExpSource expSource)
Parameters
victimEntityCoreThe entity core to extract the IExpSource from.
expSourceIExpSourceThe extracted IExpSource, or null if not found.
Returns
- bool
True if an IExpSource was found, false otherwise.
Validate(EntityCore, EntityCore, DamageResolutionContext, out float)
Override this method to implement the specific validation logic for the strategy.
protected abstract bool Validate(EntityCore collector, EntityCore victim, DamageResolutionContext dmgResolutionContext, out float multiplier)
Parameters
collectorEntityCoreThe entity attempting to collect experience.
victimEntityCoreThe entity that died and may provide experience.
dmgResolutionContextDamageResolutionContextThe damage resolution that caused the death.
multiplierfloatOutput multiplier to apply to the base experience (1.0 = full exp).
Returns
- bool
True if the strategy's conditions are met, false otherwise.