Class GameEvent
- Namespace
- ElectricDrill.AstraRpgFramework.Events
- Assembly
- com.electricdrill.astra-rpg-framework.Runtime.dll
A ScriptableObject-based event system that allows decoupled communication between game systems. GameEvents can be raised to notify all registered listeners without requiring direct references. Supports both MonoBehaviour-based listeners and code-based System.Action listeners.
[CreateAssetMenu(fileName = "New Game Event", menuName = "Astra RPG Framework/Events/Game Event")]
public class GameEvent : GameEventBase<GameEventListener, Action>
- Inheritance
-
objectGameEvent
- Inherited Members
Methods
Raise()
Raises the event, notifying all registered listeners. Listeners are snapshot before iteration so that subscribe/unsubscribe during a callback does not affect the current raise. The non-reentrant path is allocation-free after warmup.
public void Raise()
RegisterListener(GameEventListener)
Registers a listener to be notified when this event is raised. Duplicate listeners are automatically prevented.
public void RegisterListener(GameEventListener listener)
Parameters
listenerGameEventListenerThe GameEventListener to register.
UnregisterListener(GameEventListener)
Unregisters a listener so it will no longer be notified when this event is raised.
public void UnregisterListener(GameEventListener listener)
Parameters
listenerGameEventListenerThe GameEventListener to unregister.
Events
OnEventRaised
Event that can be subscribed to from code using standard C# event syntax. Automatically handles registration and unregistration of Action listeners.
public virtual event Action OnEventRaised
Event Type
- Action