Table of Contents

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
object
EntityCore
Implements
Extension Methods

Properties

Attributes

Gets the EntityAttributes component which manages the entity's attributes.

public virtual EntityAttributes Attributes { get; }

Property Value

EntityAttributes

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

EntityCore

Level

Gets the EntityLevel class which manages the entity's level and experience.

public virtual EntityLevel Level { get; }

Property Value

EntityLevel

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

EntityStats

Tags

The tags associated with this object.

public GameTagSet Tags { get; }

Property Value

GameTagSet

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

gameEvent TEvent

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

gameEvent TEvent

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