Add most of research
This commit is contained in:
36
GOAP/Assets/Scrips/Actions/GetPatient.cs
Normal file
36
GOAP/Assets/Scrips/Actions/GetPatient.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class GetPatient : AI_Action
|
||||
{
|
||||
GameObject m_Resource;
|
||||
public override bool PrePerform()
|
||||
{
|
||||
target = AI_World.Instance.RemovePatient();
|
||||
if(target == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
m_Resource = AI_World.Instance.RemoveTreatmentBed();
|
||||
if (m_Resource != null)
|
||||
{
|
||||
inventory.AddItem(m_Resource);
|
||||
} else {
|
||||
AI_World.Instance.AddPatient(target);
|
||||
target = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool PostPerform()
|
||||
{
|
||||
AI_World.Instance.GetWorld().ModifyState("Waiting", -1);
|
||||
if (target)
|
||||
{
|
||||
target.GetComponent<AI_Agent>().inventory.AddItem(m_Resource);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user