Class EntityCore
- Namespace
- ElectricDrill.AstraRpgFramework
- Assembly
- com.electricdrill.astra-rpg-framework.Runtime.dll
The core component for any entity in the game. It is the mandatory base class for all entities, providing essential functionality. Provides easy access to the entity's level, stats, and attributes.
[DisallowMultipleComponent]
public class EntityCore : MonoBehaviour, IEditorValidatable, IInvalidatable, IStatReader, IValueContainer<StatSO>, IAttributeReader, IValueContainer<AttributeSO>, ITaggable, IHasEntity, IEventRegistrar
- Inheritance
-
objectEntityCore
- Implements
- Extension Methods
Properties
Attributes
Gets the EntityAttributes component which manages the entity's attributes.
public virtual EntityAttributes Attributes { get; }
Property Value
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
Level
Gets the EntityLevel class which manages the entity's level and experience.
public virtual EntityLevel Level { get; }
Property Value
Name
Gets the name of the entity's GameObject.
public string Name { get; }
Property Value
- string
Stats
Gets the EntityStats component which manages the entity's stats.
public virtual EntityStats Stats { get; }
Property Value
Tags
The tags associated with this object.
public GameTagSet Tags { get; }
Property Value
Methods
Awake()
protected virtual void Awake()
Invalidate()
Marks this object as invalid and raises OnInvalidated.
public void Invalidate()
Start()
protected virtual void Start()
Subscribe<TEvent>(TEvent)
Registers gameEvent on the channel matching TEvent.
public void Subscribe<TEvent>(TEvent gameEvent) where TEvent : ScriptableObject
Parameters
gameEventTEvent
Type Parameters
TEvent
Exceptions
- ArgumentException
Thrown when no channel is registered for
TEvent.
Unsubscribe<TEvent>(TEvent)
Removes gameEvent from the channel matching TEvent.
public void Unsubscribe<TEvent>(TEvent gameEvent) where TEvent : ScriptableObject
Parameters
gameEventTEvent
Type Parameters
TEvent
Exceptions
- ArgumentException
Thrown when no channel is registered for
TEvent.
Update()
protected virtual void Update()
Events
OnBeforeSpawned
Raised after all EntityCore initialization is complete (level, stats, attributes) but
before the spawned event is broadcast. Sibling components that need to run logic tied
to entity spawn — such as applying innate modifiers — should subscribe to this event
in their Awake() instead of relying on script execution order.
public event Action OnBeforeSpawned
Event Type
- Action
OnInvalidated
Raised when this object is invalidated.
public event Action OnInvalidated
Event Type
- Action