예제 #1
0
    private void LootAction(Buff potentialBuff, GameObject potentialBuffGameObject, Resource lootTargetResource)
    {
        if (potentialBuff.isWeapon == true && currentWeapon == null)
        {
            unitStats.ApplyStatChanges(potentialBuff, false);
            currentWeapon = potentialBuff;
            unitEquipment.DisableWeaponComponents(potentialBuffGameObject);
            lootTargetResource.ConfirmLootTaken();
        }
        else if (potentialBuff.isWeapon == true && potentialBuff.attackRangeBonus > currentWeapon.attackRangeBonus)
        {
            unitStats.ApplyStatChanges(currentWeapon, true);
            unitEquipment.EnableWeaponComponents();
            unitStats.ApplyStatChanges(potentialBuff, false);
            currentWeapon = potentialBuff;
            unitEquipment.DisableWeaponComponents(potentialBuffGameObject);

            lootTargetResource.ConfirmLootTaken();
        }
        else if (potentialBuff.isWeapon == false && potentialBuffGameObject.GetComponent <ObjectInfo>().isNothing != true)
        {
            unitEquipment.UnpackBuff(potentialBuffGameObject);
            unitStats.ApplyStatChanges(potentialBuff, false);
            Destroy(potentialBuffGameObject);
            lootTargetResource.ConfirmLootTaken();
        }
    }
예제 #2
0
    public void UnpackBuff(GameObject newItem)
    {
        Buff newItemBuff = newItem.GetComponent <Buff>();

        unitStats.ApplyStatChanges(newItemBuff, false);
        if (newItemBuff.isWeapon == true)
        {
            currentWeapon = newItemBuff;
            DisableWeaponComponents(newItem);
        }
        else
        {
            Destroy(newItem);
        }
    }