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{ [Space(5)] public BBParameter castType; public BBParameter length; public BBParameter direction; public BBParameter offset; public BBParameter ignoreLayers; [ShowIf("castType", ((int)EnvironmentObserver.CastType.SphereCast|(int)EnvironmentObserver.CastType.SphereOverlap))] public BBParameter width; public BBParameter size; public BBParameter 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); } } }