changed: more detail to observers. gizmos fixed and editor layout cleaned up
This commit is contained in:
@@ -2,12 +2,13 @@ using NodeCanvas.Framework;
|
||||
using ParadoxNotion.Design;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
namespace NodeCanvas.Tasks.Conditions {
|
||||
[Category("Reset")]
|
||||
public class CheckEnvironmentObserver : ConditionTask<PlayerEnvironmentManager>{
|
||||
|
||||
public BBParameter<string> observerLabel;
|
||||
public BBParameter<RaycastHit> outputHitTo;
|
||||
|
||||
//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(){
|
||||
@@ -32,7 +33,22 @@ namespace NodeCanvas.Tasks.Conditions {
|
||||
//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);
|
||||
if (agent.EvaluateFromString(observerLabel.value) == true) {
|
||||
if (outputHitTo.isDefined) {
|
||||
EnvironmentObserver hitObserver = agent.FindObserverFromString(observerLabel.value, agent.observers);
|
||||
|
||||
if (hitObserver.hit.Equals(default(RaycastHit))) {
|
||||
Debug.LogError("You just tried to pull a RaycastHit for later use from an environment observer, but no RaycastHit is available. Don't forget that CastType.Box and CastType.Sphere CANNOT spit one out!");
|
||||
} else {
|
||||
outputHitTo.value = hitObserver.hit;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user