Class PlayerInteractionEventData
Event data for player interactions, such as talking to NPCs or interacting with objects. Carries the interactable that was triggered so ECA actions can cast it to the specific type.
public class PlayerInteractionEventData : EventData
- Inheritance
-
PlayerInteractionEventData
- Inherited Members
Constructors
PlayerInteractionEventData(IPlayerCharacter, IInteractable, Func<ICharacter, IInventoryController, Item, bool>)
Constructs a new PlayerInteractionEventData from the interacting player and the interactable. The base Target is populated with the interactable's GameObject so target selectors and conditions see it through the standard event flow.
public PlayerInteractionEventData(IPlayerCharacter initiator, IInteractable interactable, Func<ICharacter, IInventoryController, Item, bool> onGrantItem = null)
Parameters
initiatorIPlayerCharacterThe player character who initiated the interaction.
interactableIInteractableThe interactable object that was interacted with.
onGrantItemFunc<ICharacter, IInventoryController, Item, bool>Optional delegate for granting items with DB persistence.
Properties
Interactable
The interactable object that was interacted with. ECA actions cast this to the specific interactable interface they require (e.g., IBanker, IMerchant).
public IInteractable Interactable { get; }
Property Value
InteractionType
The concrete type name of the interactable, used for logging.
public string InteractionType { get; }
Property Value
OnGrantItem
Optional delegate that grants an item to the player's inventory and persists it to the database.
Set by the server (InteractableSystem) when creating this event data.
Returns true if the item was successfully added.
public Func<ICharacter, IInventoryController, Item, bool> OnGrantItem { get; }
Property Value
Methods
ToString()
Returns a string representation of the event data for debugging/logging.
public override string ToString()