Add most of research
This commit is contained in:
38
GOAP/Assets/Scrips/Robot.cs
Normal file
38
GOAP/Assets/Scrips/Robot.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class Robot : AI_Agent {
|
||||
|
||||
[SerializeField] TextMeshProUGUI _currentStatePrint;
|
||||
|
||||
// Start is called before the first frame update
|
||||
protected override void Start()
|
||||
{
|
||||
base.Start();
|
||||
|
||||
SubGoal s1 = new SubGoal("TreatPatient", 1, false);
|
||||
goals.Add(s1, 3);
|
||||
|
||||
var s2 = new SubGoal("Charged", 1, false);
|
||||
goals.Add(s2, 5);
|
||||
|
||||
Invoke(nameof(GetDepleted), Random.Range(10, 20));
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (_currentStatePrint != null && planner != null && currentAction != null)
|
||||
{
|
||||
// _currentStatePrint.text = "Nurse 1 Action: " + currentAction.actionName + "\n" + planner.GetPlanString();
|
||||
_currentStatePrint.text =
|
||||
"Nurse 1 Action: " + currentAction.actionName + "\n" + planner.GetPlanDescription();
|
||||
}
|
||||
}
|
||||
|
||||
void GetDepleted()
|
||||
{
|
||||
agentWorldStates.ModifyState("Depleted", 0);
|
||||
Invoke(nameof(GetDepleted), Random.Range(10, 20));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user