Class EntityClass
- Namespace
- ElectricDrill.AstraRpgFramework.Classes
- Assembly
- com.electricdrill.astra-rpg-framework.Runtime.dll
Component that represents the class of an entity in the game. Implements IClassSource to provide access to the entity's class definition.
[DisallowMultipleComponent]
public class EntityClass : MonoBehaviour, IClassSource, IEventRegistrar
- Inheritance
-
objectEntityClass
- Implements
- Extension Methods
Properties
Class
Gets or sets the class definition for this entity.
Setting a different value raises OnClassChanged and then the per-entity
class-changed game event channel; reassigning the same class is a no-op and raises nothing.
Safe to call before Awake (e.g. during spawn setup on a deactivated GameObject).
public ClassSO Class { get; set; }
Property Value
Methods
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.
Events
OnClassChanged
Raised when this entity's class is reassigned, before the game event channel. Sibling components that need to react to a class change should subscribe to this event instead of relying on script execution order.
public event Action<EntityClassChangedContext> OnClassChanged
Event Type
- Action<EntityClassChangedContext>
Operators
implicit operator ClassSO(EntityClass)
Implicit conversion operator that allows an EntityClass to be used directly as a Class.
public static implicit operator ClassSO(EntityClass entityClass)
Parameters
entityClassEntityClassThe EntityClass to convert.
Returns
- ClassSO
The Class associated with the EntityClass.