2022-12-27 15:16:59 +01:00
|
|
|
|
using System;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Note: we dont add here local counter like in (Kill condition) because amount of items may be decreasing after np selling not only increased
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Serializable]
|
|
|
|
|
public class CollectRequiredSubject : RequiredSubject
|
|
|
|
|
{
|
|
|
|
|
protected override string MODEL_LOCALIZATION => "Items/";
|
|
|
|
|
|
2023-01-03 22:44:24 +01:00
|
|
|
|
public CollectRequiredSubject(int requiredAmount) : base(requiredAmount) { }
|
|
|
|
|
|
2022-12-27 15:16:59 +01:00
|
|
|
|
public CollectRequiredSubject(RequiredSubject requiredSubject) : base(requiredSubject.RequiredAmount, requiredSubject.RequiredObject) { }
|
|
|
|
|
|
|
|
|
|
public CollectRequiredSubject(int requiredAmount, GameObject enemy) : base(requiredAmount, enemy) { }
|
|
|
|
|
|
|
|
|
|
public CollectRequiredSubject(int requiredAmount, string enemyName) : base(requiredAmount, enemyName) { }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public override bool CheckCondition()
|
|
|
|
|
{
|
|
|
|
|
var isConditionMet =
|
|
|
|
|
InventoryUIManager.Instance.FindItemInWarehouseByName(RequiredObject.gameObject.name).Count >= RequiredAmount;
|
|
|
|
|
|
|
|
|
|
if (isConditionMet)
|
|
|
|
|
for(int i = 0; i < RequiredAmount; i++)
|
|
|
|
|
InventoryUIManager.Instance.RemoveOneByItemName(RequiredObject.gameObject.name);
|
|
|
|
|
|
|
|
|
|
return isConditionMet;
|
|
|
|
|
}
|
2023-01-03 22:44:24 +01:00
|
|
|
|
}
|