using System; using UnityEngine; /// /// Note: we dont add here local counter like in (Kill condition) because amount of items may be decreasing after np selling not only increased /// [Serializable] public class CollectRequiredSubject : RequiredSubject { protected override string MODEL_LOCALIZATION => "Items/"; public CollectRequiredSubject(int requiredAmount) : base(requiredAmount) { } 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; } }