Inventory Pro

Trigger events


When a trigger is used events will be fired, which can be used run your own code. To use these either the manager can be used for global control, or the triggers can be used for individual control.

Manager

When using the manager you'll be able to hook onto the global event, which gets called whenever ANY trigger in the scene is affected. More information about trigger configurations: http://devdog.nl/documentation/triggerers/

void Start()
{
    InventoryTriggererManager.instance.OnChangedBestTriggerer += (oldTrigger, newTrigger) =>
    {
        // New 'best' trigger. The best trigger is chosen based on the settings.
        // This can either be raycast from center, or closest in range.
    };
    InventoryTriggererManager.instance.OnCursorEnterTriggerer += (triggerer) =>
    {
        // The user is hovering over the triggerer with it's cursor.
    };
    InventoryTriggererManager.instance.OnCursorExitTriggerer += (triggerer) =>
    {
        // The user stopped hovering over the triggerer with it's cursor.
    };
}

Triggerer events

If you want more fine grained control you can use the triggerer's events. There are triggerer's that can be used and un-used, like for example the vendor, and there are triggers that can only be used, like triggers (pickup only - The drop creates a new trigger object, but doesn't use it - So, use only).

ObjectTriggerer events


void Start()
{
    var trigger = GetComponent();
    trigger.OnTriggerUse += (player) =>
    {
        // This trigger was used by 'player'.
    };
    trigger.OnTriggerUnUse += (player) =>
    {
       // This trigger was un-used by 'player'.
    };
} 

ObjectTriggererItem events


void Start()
{
    var itemTrigger = GetComponent();
    itemTrigger.OnPickup += (player) =>
    {
        // This item trigger was used by 'player'.
    };
}