Pickup Event

Kibrjr

New member
Hello!
Is there a way to create events when something is picked up?
For exemple: I have a full ammo crate and an empty ammo crate, I want when I pick it up, it changes to the empty one.Screenshot_1.png
Somewhere here.
 
Your can register the ObjectPickup event on the player game object.

C#:
private void Awake()
{
    EventHandler.RegisterEvent<ObjectPickup>(gameObject, "OnObjectPickedUp", OnObjectPickedUp);
}

private void OnDestroy()
{
    EventHandler.UnregisterEvent<ObjectPickup>(gameObject, "OnObjectPickedUp", OnObjectPickedUp);
}


private void OnObjectPickedUp (ObjectPickup objectPickup)
{
    // Do stuff
}
 
How would one go about having a popup message stating ammo full when the player enters the trigger to pick up?
 
For this I would subclass the ItemPickup class, and from there you can send a new message if the item wasn't successfully picked up.
 
Top