Files
Gameshit/GOAP/Assets/Scrips/Robot.cs
2025-05-31 15:54:23 +02:00

39 lines
1.0 KiB
C#

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));
}
}