Ejemplo n.º 1
0
    /*==================================================================
    *  PASSIVES
    * ================================================================*/

    public void EquipPassive(Passive passive, int index = -1)
    {
        // Find first empty slot
        if (index == -1)
        {
            for (int i = 0; i < passives.Length; i++)
            {
                if (passives[i] == null)
                {
                    index = i;
                    break;
                }
            }
        }

        // Check that index is legal
        if (index == -1 || index >= passives.Length)
        {
            return;
        }

        //Remove old passive
        RemovePassive(index);

        // Set new passive
        passives[index] = passive;
        passive.owner   = this;

        // Equipping trigger
        passive.Tick(Trigger.Equip);
    }