Scriptum/Assets/Scripts/REFACTORING/Application/Mission/Condition/Subject/RequiredSubject.cs
2023-01-12 15:22:49 +01:00

49 lines
1.2 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
[Serializable]
public class RequiredSubject
{
protected virtual string MODEL_LOCALIZATION => "Enamies/";
[SerializeField]
public int RequiredAmount;
[SerializeField]
public GameObject RequiredObject;
public RequiredSubject(int requiredAmount)
{
RequiredAmount = requiredAmount;
}
public RequiredSubject(int requiredAmount, GameObject _object)
{
RequiredAmount = requiredAmount;
RequiredObject = _object;
}
public RequiredSubject(int requiredAmount, string objectName)
{
RequiredAmount = requiredAmount;
RequiredObject = FindObjectInResource(objectName);
}
public GameObject FindObjectInResource(string modelName)
{
var resource = Resources.Load<GameObject>(MODEL_LOCALIZATION + modelName);
if (!resource)
throw new System.Exception($"required Subject Resource {MODEL_LOCALIZATION + modelName} not found!!");
return resource;
}
public virtual bool CheckCondition() { return false; }
}