added: expanded environment observers with changed types, better gizmos, some fixes

This commit is contained in:
Chris
2025-07-22 16:12:40 -04:00
parent 43de6b0d3b
commit 355f6207a5
3 changed files with 133 additions and 7 deletions

View File

@@ -0,0 +1,38 @@
using NodeCanvas.Framework;
using ParadoxNotion.Design;
using UnityEngine;
namespace NodeCanvas.Tasks.Conditions {
[Category("Reset")]
public class CheckEnvironmentObserver : ConditionTask<PlayerEnvironmentManager>{
public BBParameter<string> observerLabel;
//Use for initialization. This is called only once in the lifetime of the task.
//Return null if init was successfull. Return an error string otherwise
protected override string OnInit(){
var observer = agent.FindObserverFromString(observerLabel.value);
if (observer == null) {
return $"An environment observer couldn't be found under the name {observerLabel.value}. Check your spelling and if it exists??";
}
return null;
}
//Called whenever the condition gets enabled.
protected override void OnEnable() {
agent.FindObserverFromString(observerLabel.value).active = true;
}
//Called whenever the condition gets disabled.
protected override void OnDisable() {
agent.FindObserverFromString(observerLabel.value).active = false;
}
//Called once per frame while the condition is active.
//Return whether the condition is success or failure.
protected override bool OnCheck(){
return agent.EvaluateFromString(observerLabel.value);
}
}
}