35 lines
1.2 KiB
C#
35 lines
1.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
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/";
|
|
|
|
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;
|
|
}
|
|
}
|