Add most of research
This commit is contained in:
29
GOAP/Assets/Scrips/Actions/Charge.cs
Normal file
29
GOAP/Assets/Scrips/Actions/Charge.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class Charge : AI_Action
|
||||
{
|
||||
public GameObject m_Resource;
|
||||
public override bool PrePerform()
|
||||
{
|
||||
m_Resource = AI_World.Instance.RemoveCharger();
|
||||
if (m_Resource == null)
|
||||
{
|
||||
return false; // No charger available
|
||||
}
|
||||
|
||||
inventory.AddItem(m_Resource);
|
||||
target = m_Resource;
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool PostPerform()
|
||||
{
|
||||
agentWorldStates.RemoveState("Depleted");
|
||||
AI_World.Instance.AddCharger(m_Resource);
|
||||
m_Resource = null; // Clear the resource after use
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
2
GOAP/Assets/Scrips/Actions/Charge.cs.meta
Normal file
2
GOAP/Assets/Scrips/Actions/Charge.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d65acb659c17edb43b07f1984ce199a1
|
||||
14
GOAP/Assets/Scrips/Actions/CheckIn.cs
Normal file
14
GOAP/Assets/Scrips/Actions/CheckIn.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class CheckIn : AI_Action
|
||||
{
|
||||
public override bool PrePerform()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool PostPerform()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
2
GOAP/Assets/Scrips/Actions/CheckIn.cs.meta
Normal file
2
GOAP/Assets/Scrips/Actions/CheckIn.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: da447a39bb3a3c144a8a1245dac6953d
|
||||
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;
|
||||
}
|
||||
}
|
||||
2
GOAP/Assets/Scrips/Actions/GetPatient.cs.meta
Normal file
2
GOAP/Assets/Scrips/Actions/GetPatient.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1a3594ff153540945b38f6c6e7969913
|
||||
23
GOAP/Assets/Scrips/Actions/GetTreated.cs
Normal file
23
GOAP/Assets/Scrips/Actions/GetTreated.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
|
||||
public class GetTreated : AI_Action
|
||||
{
|
||||
public override bool PrePerform()
|
||||
{
|
||||
target = inventory.FindItemWithTag("Bed");
|
||||
if(target == null)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool PostPerform()
|
||||
{
|
||||
AI_World.Instance.GetWorld().ModifyState("Treated", 1);
|
||||
agentWorldStates.ModifyState("IsCured", 1);
|
||||
inventory.RemoveItem(target);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
2
GOAP/Assets/Scrips/Actions/GetTreated.cs.meta
Normal file
2
GOAP/Assets/Scrips/Actions/GetTreated.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b134cecb1ecf86140a6bef65725746b3
|
||||
17
GOAP/Assets/Scrips/Actions/GoHome.cs
Normal file
17
GOAP/Assets/Scrips/Actions/GoHome.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
|
||||
public class GoHome : AI_Action
|
||||
{
|
||||
public override bool PrePerform()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool PostPerform()
|
||||
{
|
||||
AI_World.Instance.GetWorld().ModifyState("Home", 1);
|
||||
Destroy(this.gameObject);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
2
GOAP/Assets/Scrips/Actions/GoHome.cs.meta
Normal file
2
GOAP/Assets/Scrips/Actions/GoHome.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ee0072bcc9d306949b2510eb33147033
|
||||
24
GOAP/Assets/Scrips/Actions/GoToBed.cs
Normal file
24
GOAP/Assets/Scrips/Actions/GoToBed.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class GoToBed : AI_Action
|
||||
{
|
||||
public override bool PrePerform()
|
||||
{
|
||||
target = inventory.FindItemWithTag("Bed");
|
||||
if(target == null)
|
||||
return false;
|
||||
|
||||
AI_World.Instance.GetWorld().ModifyState("TreatingPatient", 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool PostPerform()
|
||||
{
|
||||
|
||||
AI_World.Instance.GetWorld().ModifyState("TreatingPatient", -1);
|
||||
AI_World.Instance.AddTreatmentBed(target);
|
||||
inventory.RemoveItem(target);
|
||||
// AI_World.Instance.GetWorld().ModifyState("FreeBeds", 1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
2
GOAP/Assets/Scrips/Actions/GoToBed.cs.meta
Normal file
2
GOAP/Assets/Scrips/Actions/GoToBed.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9744404dabc38e24390e5f04a158b73d
|
||||
14
GOAP/Assets/Scrips/Actions/GoToHospital.cs
Normal file
14
GOAP/Assets/Scrips/Actions/GoToHospital.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class GoToHospital : AI_Action
|
||||
{
|
||||
public override bool PrePerform()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool PostPerform()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
2
GOAP/Assets/Scrips/Actions/GoToHospital.cs.meta
Normal file
2
GOAP/Assets/Scrips/Actions/GoToHospital.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: df82dab2aef220d4eaf8d1953b5668d3
|
||||
17
GOAP/Assets/Scrips/Actions/GoToWaitingRoom.cs
Normal file
17
GOAP/Assets/Scrips/Actions/GoToWaitingRoom.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class GoToWaitingRoom : AI_Action
|
||||
{
|
||||
public override bool PrePerform()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool PostPerform()
|
||||
{
|
||||
AI_World.Instance.GetWorld().ModifyState("Waiting", 1);
|
||||
AI_World.Instance.AddPatient(this.gameObject);
|
||||
agentWorldStates.ModifyState("InWaitingRoom", 1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
2
GOAP/Assets/Scrips/Actions/GoToWaitingRoom.cs.meta
Normal file
2
GOAP/Assets/Scrips/Actions/GoToWaitingRoom.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e80a344ad86244145a0a6408b77f4a9d
|
||||
Reference in New Issue
Block a user