Class EntityLevelChangedContext
- Namespace
- ElectricDrill.AstraRpgFramework.Events.Contexts
- Assembly
- com.electricdrill.astra-rpg-framework.Runtime.dll
Payload describing an entity level change event. Exposes the leveled entity both as a generic payload entity and as the payload target.
public class EntityLevelChangedContext : IHasTarget, IHasEntity, IHasValueChange<int>
- Inheritance
-
objectEntityLevelChangedContext
- Implements
-
IHasValueChange<int>
Constructors
EntityLevelChangedContext(EntityCore, int, int)
Initializes a new instance of EntityLevelChangedContext.
public EntityLevelChangedContext(EntityCore target, int previousValue, int newValue)
Parameters
targetEntityCoreThe entity whose level changed.
previousValueintThe level before the change.
newValueintThe level after the change.
Properties
AbsAmount
The absolute amount of change between PreviousValue and NewValue.
public int AbsAmount { get; }
Property Value
- int
Remarks
Here: the number of levels crossed. A level change is raised once per transition, not once per level, so a jump from 1 to 50 arrives as a single event with an AbsAmount of 49 — listeners that need per-level granularity (one reward, one fanfare per level) iterate over this.
Entity
The primary EntityCore associated with this object. For entity components this is the owning entity; for context payloads this is the primary affected subject (e.g. the event target).
public EntityCore Entity { get; }
Property Value
NewValue
The level value after the change happened.
public int NewValue { get; }
Property Value
- int
PreviousValue
The level value before the change happened.
public int PreviousValue { get; }
Property Value
- int
Target
public EntityCore Target { get; }