fix: more movement and observer tweaks and fixes

This commit is contained in:
Chris
2025-07-30 13:22:36 -04:00
parent ae1908013d
commit 598fa9f6fc
8 changed files with 188 additions and 76 deletions

View File

@@ -0,0 +1,63 @@
using System.Drawing;
using NodeCanvas.Framework;
using ParadoxNotion.Design;
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace Reset {
[Category("Reset")]
[Description("Creates an environment observer unattached from the player, such as for checking from the Camera or another arbitray location.")]
public class CheckGenericObserver : ConditionTask<Transform>{
[Space(5)]
public BBParameter<EnvironmentObserver.CastType> castType;
public BBParameter<float> length;
public BBParameter<Vector3> direction;
public BBParameter<Vector3> offset;
public BBParameter<LayerMask> ignoreLayers;
[ShowIf("castType", ((int)EnvironmentObserver.CastType.SphereCast|(int)EnvironmentObserver.CastType.SphereOverlap))]
public BBParameter<float> width;
public BBParameter<Vector3> size;
public BBParameter<Vector3> rotation;
private EnvironmentObserver observer;
//Return null if init was successfull. Return an error string otherwise
protected override string OnInit(){
return null;
}
//Called whenever the condition gets enabled.
protected override void OnEnable() {
observer = new EnvironmentObserver(){
castType = EnvironmentObserver.CastType.SphereCast,
length = length.value,
direction = direction.value,
offset = offset.value,
width = width.value,
size = size.value,
rotation = rotation.value
};
}
//Called whenever the condition gets disabled.
protected override void OnDisable() {
}
//Called once per frame while the condition is active.
//Return whether the condition is success or failure.
protected override bool OnCheck() {
return observer.Evaluate(agent.gameObject);
}
}
}