Beispiel #1
0
    /**
     * FUNCTION NAME: CollectKey
     * DESCRIPTION  : Collects a key and adds it to the hero inventory.
     * INPUTS       : _key - Key game object collected.
     * OUTPUTS      : None
     **/
    void CollectKey(GameObject _key)
    {
        var keyColorCode = _key.GetComponent <ColorCode>();
        var keyColor     = keyColorCode.m_TileColor;

        m_CollectedKeys.Add(keyColor);
        Destroy(_key);
        GlobalData.DispatchKeyCollected(keyColor);
        //TODO: handle feedback.
    }
Beispiel #2
0
    public void Collected(Key key)
    {
        var color = key.m_Color;

        GlobalData.DispatchKeyCollected(color);

        var eventData = new KeyCollectorEventData()
        {
            m_Key   = key,
            m_Color = color,
        };

        m_Events.Collected.Invoke(eventData);
    }