Exemplo n.º 1
0
    //Internal method to generete item and event-type specific events.
    private void GenerateItemEvent(InventoryItem item, E_ItemEventType requestedEventType)
    {
        int eventsFound = 0;

        foreach (C_ItemEvent ie in ItemEvents)
        {
            if (ie.item != null)
            {
                if (ie.item.name == item.name)
                {
                    if (ie.eventType == requestedEventType)
                    {
                        ie.OnEvent.Invoke();
                        eventsFound++;
                    }
                }
            }
            else
            {
                //the element is missing (in inspector)
            }
        }
        if (eventsFound != 1)
        {
            mDebug("There is a possibility for missing/duplicate events for the event '" + requestedEventType.ToString() + "' of item '" + item.name + "': There were " + eventsFound.ToString() + " events excuted.");
        }
    }
Exemplo n.º 2
0
    //Internal method to generete category and event-type specific events.
    private void GenerateCategoryEvent(ItemDefinitions.E_ItemCategory category, E_ItemEventType requestedEventType)
    {
        int eventsFound = 0;

        foreach (C_CategoryEvent ce in CategoryEvents)
        {
            if (ce.category == category)
            {
                if (ce.eventType == requestedEventType)
                {
                    ce.OnEvent.Invoke();
                    eventsFound++;
                }
            }
        }
        if (eventsFound != 1)
        {
            mDebug("There is a possibility for missing/duplicate events for the event '" + requestedEventType.ToString() + "' of category '" + category.ToString() + "': There were " + eventsFound.ToString() + " events excuted.");
        }
    }