first commit

This commit is contained in:
Chris
2025-03-12 14:22:16 -04:00
commit 0ad0c01249
1999 changed files with 189708 additions and 0 deletions

View File

@@ -0,0 +1,77 @@
using NodeCanvas.Framework;
using ParadoxNotion.Design;
using UnityEngine;
namespace NodeCanvas.Tasks.Conditions
{
[Category("GameObject")]
[Description("A combination of line of sight and view angle check")]
public class CanSeeTarget : ConditionTask<Transform>
{
[RequiredField]
public BBParameter<GameObject> target;
[Tooltip("Distance within which to look out for.")]
public BBParameter<float> maxDistance = 50;
[Tooltip("A layer mask to use for line of sight check.")]
public BBParameter<LayerMask> layerMask = (LayerMask)( -1 );
[Tooltip("Distance within which the target can be seen (or rather sensed) regardless of view angle.")]
public BBParameter<float> awarnessDistance = 0f;
[SliderField(1, 180)]
public BBParameter<float> viewAngle = 70f;
public Vector3 offset;
private RaycastHit hit;
protected override string info {
get { return "Can See " + target; }
}
protected override bool OnCheck() {
var t = target.value.transform;
if ( !t.gameObject.activeInHierarchy ) {
return false;
}
if ( Vector3.Distance(agent.position, t.position) <= awarnessDistance.value ) {
if ( Physics.Linecast(agent.position + offset, t.position + offset, out hit, layerMask.value) ) {
if ( hit.collider != t.GetComponent<Collider>() ) {
return false;
}
}
return true;
}
if ( Vector3.Distance(agent.position, t.position) > maxDistance.value ) {
return false;
}
if ( Vector3.Angle(t.position - agent.position, agent.forward) > viewAngle.value ) {
return false;
}
if ( Physics.Linecast(agent.position + offset, t.position + offset, out hit, layerMask.value) ) {
if ( hit.collider != t.GetComponent<Collider>() ) {
return false;
}
}
return true;
}
public override void OnDrawGizmosSelected() {
if ( agent != null ) {
Gizmos.DrawLine(agent.position, agent.position + offset);
Gizmos.DrawLine(agent.position + offset, agent.position + offset + ( agent.forward * maxDistance.value ));
Gizmos.DrawWireSphere(agent.position + offset + ( agent.forward * maxDistance.value ), 0.1f);
Gizmos.DrawWireSphere(agent.position, awarnessDistance.value);
Gizmos.matrix = Matrix4x4.TRS(agent.position + offset, agent.rotation, Vector3.one);
Gizmos.DrawFrustum(Vector3.zero, viewAngle.value, 5, 0, 1f);
}
}
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 24defae9036e18b49a10c8d0f1bc7b7e
timeCreated: 1428001303
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 14914
packageName: NodeCanvas
packageVersion: 3.3.1
assetPath: Assets/ParadoxNotion/NodeCanvas/Tasks/Conditions/GameObject/CanSeeTarget.cs
uploadId: 704937

View File

@@ -0,0 +1,75 @@
using NodeCanvas.Framework;
using ParadoxNotion.Design;
using UnityEngine;
namespace NodeCanvas.Tasks.Conditions
{
[Category("GameObject")]
[Description("A combination of line of sight and view angle check")]
public class CanSeeTarget2D : ConditionTask<Transform>
{
[RequiredField]
public BBParameter<GameObject> target;
[Tooltip("Distance within which to look out for.")]
public BBParameter<float> maxDistance = 50;
[Tooltip("A layer mask to use for the line of sight check.")]
public BBParameter<LayerMask> layerMask = (LayerMask)( -1 );
[Tooltip("Distance within which the target can be seen (or rather sensed) regardless of view angle.")]
public BBParameter<float> awarnessDistance = 0f;
[SliderField(1, 180)]
public BBParameter<float> viewAngle = 70f;
public Vector2 offset;
private RaycastHit2D hit;
protected override string info {
get { return "Can See " + target; }
}
protected override bool OnCheck() {
var t = target.value.transform;
if ( !t.gameObject.activeInHierarchy ) {
return false;
}
if ( Vector2.Distance(agent.position, t.position) <= awarnessDistance.value ) {
var hit = Physics2D.Linecast((Vector2)agent.position + offset, (Vector2)t.position + offset, layerMask.value);
if ( hit.collider != t.GetComponent<Collider2D>() ) {
return false;
}
return true;
}
if ( Vector2.Distance(agent.position, t.position) > maxDistance.value ) {
return false;
}
if ( Vector2.Angle((Vector2)t.position - (Vector2)agent.position, agent.right) > viewAngle.value ) {
return false;
}
var hit2 = Physics2D.Linecast((Vector2)agent.position + offset, (Vector2)t.position + offset, layerMask.value);
if ( hit2.collider != t.GetComponent<Collider2D>() ) {
return false;
}
return true;
}
public override void OnDrawGizmosSelected() {
if ( agent != null ) {
Gizmos.DrawLine((Vector2)agent.position, (Vector2)agent.position + offset);
Gizmos.DrawLine((Vector2)agent.position + offset, (Vector2)agent.position + offset + ( (Vector2)agent.right * maxDistance.value ));
Gizmos.DrawWireSphere((Vector2)agent.position + offset + ( (Vector2)agent.right * maxDistance.value ), 0.1f);
Gizmos.DrawWireSphere((Vector2)agent.position, awarnessDistance.value);
Gizmos.matrix = Matrix4x4.TRS((Vector2)agent.position + offset, Quaternion.LookRotation(agent.right), Vector3.one);
Gizmos.DrawFrustum(Vector3.zero, viewAngle.value, 5, 0, 1f);
}
}
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 585731d3c9972a74084a0d4faed3a76e
timeCreated: 1428001303
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 14914
packageName: NodeCanvas
packageVersion: 3.3.1
assetPath: Assets/ParadoxNotion/NodeCanvas/Tasks/Conditions/GameObject/CanSeeTarget2D.cs
uploadId: 704937

View File

@@ -0,0 +1,92 @@
using System.Collections.Generic;
using System.Linq;
using NodeCanvas.Framework;
using ParadoxNotion.Design;
using UnityEngine;
namespace NodeCanvas.Tasks.Conditions
{
[Category("GameObject")]
[Description("A combination of line of sight and view angle check")]
public class CanSeeTargetAny : ConditionTask<Transform>
{
public BBParameter<List<GameObject>> targetObjects;
public BBParameter<float> maxDistance = 50;
public BBParameter<LayerMask> layerMask = (LayerMask)( -1 );
public BBParameter<float> awarnessDistance = 0f;
[SliderField(1, 180)]
public BBParameter<float> viewAngle = 70f;
public Vector3 offset;
[BlackboardOnly]
public BBParameter<List<GameObject>> allResults;
[BlackboardOnly]
public BBParameter<GameObject> closerResult;
private RaycastHit hit;
protected override string info { get { return "Can See Any " + targetObjects; } }
protected override bool OnCheck() {
var r = false;
var store = !allResults.isNone || !closerResult.isNone;
var temp = store ? new List<GameObject>() : null;
foreach ( var o in targetObjects.value ) {
if ( o == agent.gameObject ) { continue; }
var t = o.transform;
if ( !t.gameObject.activeInHierarchy ) { continue; }
if ( Vector3.Distance(agent.position, t.position) < awarnessDistance.value ) {
if ( Physics.Linecast(agent.position + offset, t.position + offset, out hit, layerMask.value) ) {
if ( hit.collider != t.GetComponent<Collider>() ) { continue; }
}
if ( store ) { temp.Add(o); }
r = true;
continue;
}
if ( Vector3.Distance(agent.position, t.position) > maxDistance.value ) {
continue;
}
if ( Vector3.Angle(t.position - agent.position, agent.forward) > viewAngle.value ) {
continue;
}
if ( Physics.Linecast(agent.position + offset, t.position + offset, out hit, layerMask.value) ) {
if ( hit.collider != t.GetComponent<Collider>() ) { continue; }
}
if ( store ) { temp.Add(o); }
r = true;
}
if ( store ) {
var ordered = temp.OrderBy(x => Vector3.Distance(agent.position, x.transform.position));
if ( !allResults.isNone ) { allResults.value = ordered.ToList(); }
if ( !closerResult.isNone ) { closerResult.value = ordered.FirstOrDefault(); }
}
return r;
}
public override void OnDrawGizmosSelected() {
if ( agent != null ) {
Gizmos.DrawLine(agent.position, agent.position + offset);
Gizmos.DrawLine(agent.position + offset, agent.position + offset + ( agent.forward * maxDistance.value ));
Gizmos.DrawWireSphere(agent.position + offset + ( agent.forward * maxDistance.value ), 0.1f);
Gizmos.DrawWireSphere(agent.position, awarnessDistance.value);
Gizmos.matrix = Matrix4x4.TRS(agent.position + offset, agent.rotation, Vector3.one);
Gizmos.DrawFrustum(Vector3.zero, viewAngle.value, 5, 0, 1f);
}
}
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: ec5a1168d1d24034b82ad5ef3a95d75c
timeCreated: 1428001303
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 14914
packageName: NodeCanvas
packageVersion: 3.3.1
assetPath: Assets/ParadoxNotion/NodeCanvas/Tasks/Conditions/GameObject/CanSeeTargetAny.cs
uploadId: 704937

View File

@@ -0,0 +1,88 @@
using System.Collections.Generic;
using System.Linq;
using NodeCanvas.Framework;
using ParadoxNotion.Design;
using UnityEngine;
namespace NodeCanvas.Tasks.Conditions
{
[Category("GameObject")]
[Description("A combination of line of sight and view angle check")]
public class CanSeeTargetAny2D : ConditionTask<Transform>
{
public BBParameter<List<GameObject>> targetObjects;
public BBParameter<float> maxDistance = 50;
public BBParameter<LayerMask> layerMask = (LayerMask)( -1 );
public BBParameter<float> awarnessDistance = 0f;
[SliderField(1, 180)]
public BBParameter<float> viewAngle = 70f;
public Vector2 offset;
[BlackboardOnly]
public BBParameter<List<GameObject>> allResults;
[BlackboardOnly]
public BBParameter<GameObject> closerResult;
protected override string info { get { return "Can See Any " + targetObjects; } }
protected override bool OnCheck() {
var r = false;
var store = !allResults.isNone || !closerResult.isNone;
var temp = store ? new List<GameObject>() : null;
foreach ( var o in targetObjects.value ) {
if ( o == agent.gameObject ) { continue; }
var t = o.transform;
if ( !t.gameObject.activeInHierarchy ) { continue; }
if ( Vector2.Distance(agent.position, t.position) < awarnessDistance.value ) {
var hit = Physics2D.Linecast((Vector2)agent.position + offset, (Vector2)t.position + offset, layerMask.value);
if ( hit.collider != t.GetComponent<Collider2D>() ) { continue; }
if ( store ) { temp.Add(o); }
r = true;
continue;
}
if ( Vector2.Distance(agent.position, t.position) > maxDistance.value ) {
continue;
}
if ( Vector2.Angle((Vector2)t.position - (Vector2)agent.position, agent.right) > viewAngle.value ) {
continue;
}
var hit2 = Physics2D.Linecast((Vector2)agent.position + offset, (Vector2)t.position + offset, layerMask.value);
if ( hit2.collider != t.GetComponent<Collider2D>() ) { continue; }
if ( store ) { temp.Add(o); }
r = true;
}
if ( store ) {
var ordered = temp.OrderBy(x => Vector3.Distance(agent.position, x.transform.position));
if ( !allResults.isNone ) { allResults.value = ordered.ToList(); }
if ( !closerResult.isNone ) { closerResult.value = ordered.FirstOrDefault(); }
}
return r;
}
public override void OnDrawGizmosSelected() {
if ( agent != null ) {
Gizmos.DrawLine((Vector2)agent.position, (Vector2)agent.position + offset);
Gizmos.DrawLine((Vector2)agent.position + offset, (Vector2)agent.position + offset + ( (Vector2)agent.right * maxDistance.value ));
Gizmos.DrawWireSphere((Vector2)agent.position + offset + ( (Vector2)agent.right * maxDistance.value ), 0.1f);
Gizmos.DrawWireSphere((Vector2)agent.position, awarnessDistance.value);
Gizmos.matrix = Matrix4x4.TRS((Vector2)agent.position + offset, agent.rotation, Vector3.one);
Gizmos.DrawFrustum(Vector3.zero, viewAngle.value, 5, 0, 1f);
}
}
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: caff353d1a7b8614d9718d32ba1a56ef
timeCreated: 1428001303
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 14914
packageName: NodeCanvas
packageVersion: 3.3.1
assetPath: Assets/ParadoxNotion/NodeCanvas/Tasks/Conditions/GameObject/CanSeeTargetAny2D.cs
uploadId: 704937

View File

@@ -0,0 +1,37 @@
using NodeCanvas.Framework;
using ParadoxNotion;
using ParadoxNotion.Design;
using UnityEngine;
namespace NodeCanvas.Tasks.Conditions
{
[Name("Target Within Distance")]
[Category("GameObject")]
public class CheckDistanceToGameObject : ConditionTask<Transform>
{
[RequiredField]
public BBParameter<GameObject> checkTarget;
public CompareMethod checkType = CompareMethod.LessThan;
public BBParameter<float> distance = 10;
[SliderField(0, 0.1f)]
public float floatingPoint = 0.05f;
protected override string info {
get { return "Distance" + OperationTools.GetCompareString(checkType) + distance + " to " + checkTarget; }
}
protected override bool OnCheck() {
return OperationTools.Compare(Vector3.Distance(agent.position, checkTarget.value.transform.position), distance.value, checkType, floatingPoint);
}
public override void OnDrawGizmosSelected() {
if ( agent != null ) {
Gizmos.DrawWireSphere(agent.position, distance.value);
}
}
}
}

View File

@@ -0,0 +1,15 @@
fileFormatVersion: 2
guid: ee036437d1baa47408c144d0ff96e603
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
AssetOrigin:
serializedVersion: 1
productId: 14914
packageName: NodeCanvas
packageVersion: 3.3.1
assetPath: Assets/ParadoxNotion/NodeCanvas/Tasks/Conditions/GameObject/CheckDistanceToGameObject.cs
uploadId: 704937

View File

@@ -0,0 +1,37 @@
using NodeCanvas.Framework;
using ParadoxNotion;
using ParadoxNotion.Design;
using UnityEngine;
namespace NodeCanvas.Tasks.Conditions
{
[Name("Target Within Distance 2D")]
[Category("GameObject")]
public class CheckDistanceToGameObject2D : ConditionTask<Transform>
{
[RequiredField]
public BBParameter<GameObject> checkTarget;
public CompareMethod checkType = CompareMethod.LessThan;
public BBParameter<float> distance = 10;
[SliderField(0, 0.1f)]
public float floatingPoint = 0.05f;
protected override string info {
get { return "Distance" + OperationTools.GetCompareString(checkType) + distance + " to " + checkTarget; }
}
protected override bool OnCheck() {
return OperationTools.Compare(Vector2.Distance(agent.position, checkTarget.value.transform.position), distance.value, checkType, floatingPoint);
}
public override void OnDrawGizmosSelected() {
if ( agent != null ) {
Gizmos.DrawWireSphere((Vector2)agent.position, distance.value);
}
}
}
}

View File

@@ -0,0 +1,15 @@
fileFormatVersion: 2
guid: 040adba212104994f8e1d54ad0a79cd6
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
AssetOrigin:
serializedVersion: 1
productId: 14914
packageName: NodeCanvas
packageVersion: 3.3.1
assetPath: Assets/ParadoxNotion/NodeCanvas/Tasks/Conditions/GameObject/CheckDistanceToGameObject2D.cs
uploadId: 704937

View File

@@ -0,0 +1,58 @@
using System.Collections.Generic;
using System.Linq;
using NodeCanvas.Framework;
using ParadoxNotion;
using ParadoxNotion.Design;
using UnityEngine;
namespace NodeCanvas.Tasks.Conditions
{
[Name("Any Target Within Distance")]
[Category("GameObject")]
public class CheckDistanceToGameObjectAny : ConditionTask<Transform>
{
public BBParameter<List<GameObject>> targetObjects;
public CompareMethod checkType = CompareMethod.LessThan;
public BBParameter<float> distance = 10;
[SliderField(0, 0.1f)]
public float floatingPoint = 0.05f;
[BlackboardOnly]
public BBParameter<List<GameObject>> allResults;
[BlackboardOnly]
public BBParameter<GameObject> closerResult;
protected override string info {
get { return "Distance Any" + OperationTools.GetCompareString(checkType) + distance + " in " + targetObjects; }
}
protected override bool OnCheck() {
var r = false;
var temp = new List<GameObject>();
foreach ( var o in targetObjects.value ) {
if ( o == agent.gameObject ) { continue; }
if ( OperationTools.Compare(Vector3.Distance(agent.position, o.transform.position), distance.value, checkType, floatingPoint) ) {
temp.Add(o);
r = true;
}
}
if ( !allResults.isNone || !closerResult.isNone ) {
var ordered = temp.OrderBy(x => Vector3.Distance(agent.position, x.transform.position));
if ( !allResults.isNone ) { allResults.value = ordered.ToList(); }
if ( !closerResult.isNone ) { closerResult.value = ordered.FirstOrDefault(); }
}
return r;
}
public override void OnDrawGizmosSelected() {
if ( agent != null ) { Gizmos.DrawWireSphere(agent.position, distance.value); }
}
}
}

View File

@@ -0,0 +1,15 @@
fileFormatVersion: 2
guid: 2081a0ddb30934a4380c1c61b6e587a9
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
AssetOrigin:
serializedVersion: 1
productId: 14914
packageName: NodeCanvas
packageVersion: 3.3.1
assetPath: Assets/ParadoxNotion/NodeCanvas/Tasks/Conditions/GameObject/CheckDistanceToGameObjectAny.cs
uploadId: 704937

View File

@@ -0,0 +1,58 @@
using System.Collections.Generic;
using System.Linq;
using NodeCanvas.Framework;
using ParadoxNotion;
using ParadoxNotion.Design;
using UnityEngine;
namespace NodeCanvas.Tasks.Conditions
{
[Name("Any Target Within Distance 2D")]
[Category("GameObject")]
public class CheckDistanceToGameObjectAny2D : ConditionTask<Transform>
{
public BBParameter<List<GameObject>> targetObjects;
public CompareMethod checkType = CompareMethod.LessThan;
public BBParameter<float> distance = 10;
[SliderField(0, 0.1f)]
public float floatingPoint = 0.05f;
[BlackboardOnly]
public BBParameter<List<GameObject>> allResults;
[BlackboardOnly]
public BBParameter<GameObject> closerResult;
protected override string info {
get { return "Distance Any" + OperationTools.GetCompareString(checkType) + distance + " in " + targetObjects; }
}
protected override bool OnCheck() {
var r = false;
var temp = new List<GameObject>();
foreach ( var o in targetObjects.value ) {
if ( o == agent.gameObject ) { continue; }
if ( OperationTools.Compare(Vector2.Distance(agent.position, o.transform.position), distance.value, checkType, floatingPoint) ) {
temp.Add(o);
r = true;
}
}
if ( !allResults.isNone || !closerResult.isNone ) {
var ordered = temp.OrderBy(x => Vector2.Distance(agent.position, x.transform.position));
if ( !allResults.isNone ) { allResults.value = ordered.ToList(); }
if ( !closerResult.isNone ) { closerResult.value = ordered.FirstOrDefault(); }
}
return r;
}
public override void OnDrawGizmosSelected() {
if ( agent != null ) { Gizmos.DrawWireSphere((Vector2)agent.position, distance.value); }
}
}
}

View File

@@ -0,0 +1,15 @@
fileFormatVersion: 2
guid: fbfc071aab573584c8f51844d1231734
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
AssetOrigin:
serializedVersion: 1
productId: 14914
packageName: NodeCanvas
packageVersion: 3.3.1
assetPath: Assets/ParadoxNotion/NodeCanvas/Tasks/Conditions/GameObject/CheckDistanceToGameObjectAny2D.cs
uploadId: 704937

View File

@@ -0,0 +1,49 @@
using NodeCanvas.Framework;
using ParadoxNotion.Design;
using UnityEngine;
namespace NodeCanvas.Tasks.Conditions
{
[Name("Target In Line Of Sight")]
[Category("GameObject")]
[Description("Check of agent is in line of sight with target by doing a linecast and optionaly save the distance")]
public class CheckLOS : ConditionTask<Transform>
{
[RequiredField]
public BBParameter<GameObject> LOSTarget;
public BBParameter<LayerMask> layerMask = (LayerMask)( -1 );
public Vector3 offset;
[BlackboardOnly]
public BBParameter<float> saveDistanceAs;
private RaycastHit hit = new RaycastHit();
protected override string info {
get { return "LOS with " + LOSTarget.ToString(); }
}
protected override bool OnCheck() {
var t = LOSTarget.value.transform;
if ( Physics.Linecast(agent.position + offset, t.position + offset, out hit, layerMask.value) ) {
var targetCollider = t.GetComponent<Collider>();
if ( targetCollider == null || hit.collider != targetCollider ) {
saveDistanceAs.value = hit.distance;
return false;
}
}
return true;
}
public override void OnDrawGizmosSelected() {
if ( agent && LOSTarget.value ) {
Gizmos.DrawLine(agent.position + offset, LOSTarget.value.transform.position + offset);
}
}
}
}

View File

@@ -0,0 +1,15 @@
fileFormatVersion: 2
guid: 3d43904d3fbdf06438821b8d1027fedb
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
AssetOrigin:
serializedVersion: 1
productId: 14914
packageName: NodeCanvas
packageVersion: 3.3.1
assetPath: Assets/ParadoxNotion/NodeCanvas/Tasks/Conditions/GameObject/CheckLOS.cs
uploadId: 704937

View File

@@ -0,0 +1,43 @@
using System.Linq;
using NodeCanvas.Framework;
using ParadoxNotion.Design;
using UnityEngine;
namespace NodeCanvas.Tasks.Conditions
{
[Name("Target In Line Of Sight 2D")]
[Category("GameObject")]
[Description("Check of agent is in line of sight with target by doing a linecast and optionaly save the distance")]
public class CheckLOS2D : ConditionTask<Transform>
{
[RequiredField]
public BBParameter<GameObject> LOSTarget;
public BBParameter<LayerMask> layerMask = (LayerMask)( -1 );
[BlackboardOnly]
public BBParameter<float> saveDistanceAs;
[GetFromAgent]
protected Collider2D agentCollider;
protected override string info => "LOS with " + LOSTarget.ToString();
protected override bool OnCheck() {
var hits = Physics2D.LinecastAll(agent.position, LOSTarget.value.transform.position, layerMask.value);
foreach ( var collider in hits.Select(h => h.collider) ) {
if ( collider != agentCollider && collider != LOSTarget.value.GetComponent<Collider2D>() ) {
return false;
}
}
saveDistanceAs.value = Vector2.Distance(LOSTarget.value.transform.position, agent.position);
return true;
}
public override void OnDrawGizmosSelected() {
if ( agent && LOSTarget.value ) {
Gizmos.DrawLine((Vector2)agent.position, (Vector2)LOSTarget.value.transform.position);
}
}
}
}

View File

@@ -0,0 +1,15 @@
fileFormatVersion: 2
guid: a094ea2888e4de84485d19ef28255a25
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
AssetOrigin:
serializedVersion: 1
productId: 14914
packageName: NodeCanvas
packageVersion: 3.3.1
assetPath: Assets/ParadoxNotion/NodeCanvas/Tasks/Conditions/GameObject/CheckLOS2D.cs
uploadId: 704937

View File

@@ -0,0 +1,29 @@
using UnityEngine;
using NodeCanvas.Framework;
using ParadoxNotion;
using ParadoxNotion.Design;
namespace NodeCanvas.Tasks.Actions
{
[Category("GameObject")]
[Description("Checks the current speed of the agent against a value based on it's Rigidbody velocity")]
public class CheckSpeed : ConditionTask<Rigidbody>
{
public CompareMethod checkType = CompareMethod.EqualTo;
public BBParameter<float> value;
[SliderField(0, 0.1f)]
public float differenceThreshold = 0.05f;
protected override string info {
get { return "Speed" + OperationTools.GetCompareString(checkType) + value; }
}
protected override bool OnCheck() {
var speed = agent.linearVelocity.magnitude;
return OperationTools.Compare((float)speed, (float)value.value, checkType, differenceThreshold);
}
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 9f9579cb895fe914f91b86e4d967dc8e
timeCreated: 1441577646
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 14914
packageName: NodeCanvas
packageVersion: 3.3.1
assetPath: Assets/ParadoxNotion/NodeCanvas/Tasks/Conditions/GameObject/CheckSpeed.cs
uploadId: 704937

View File

@@ -0,0 +1,17 @@
using NodeCanvas.Framework;
using ParadoxNotion.Design;
using UnityEngine;
namespace NodeCanvas.Tasks.Conditions
{
[Category("GameObject")]
public class HasComponent<T> : ConditionTask<Transform> where T : Component
{
protected override bool OnCheck() {
return agent.GetComponent<T>() != null;
}
}
}

View File

@@ -0,0 +1,15 @@
fileFormatVersion: 2
guid: 54d501a28e4c61641bbdabcd32831cee
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
AssetOrigin:
serializedVersion: 1
productId: 14914
packageName: NodeCanvas
packageVersion: 3.3.1
assetPath: Assets/ParadoxNotion/NodeCanvas/Tasks/Conditions/GameObject/HasComponent.cs
uploadId: 704937

View File

@@ -0,0 +1,17 @@
using NodeCanvas.Framework;
using ParadoxNotion.Design;
using UnityEngine;
namespace NodeCanvas.Tasks.Conditions
{
[Category("GameObject")]
public class IsActive : ConditionTask<Transform>
{
protected override string info => agentInfo + " is Active";
protected override bool OnCheck() {
return agent.gameObject.activeInHierarchy;
}
}
}

View File

@@ -0,0 +1,15 @@
fileFormatVersion: 2
guid: 9c9c80ad76ba5b4479f11d98fc4b3d7c
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
AssetOrigin:
serializedVersion: 1
productId: 14914
packageName: NodeCanvas
packageVersion: 3.3.1
assetPath: Assets/ParadoxNotion/NodeCanvas/Tasks/Conditions/GameObject/IsActive.cs
uploadId: 704937

View File

@@ -0,0 +1,35 @@
using NodeCanvas.Framework;
using ParadoxNotion.Design;
using UnityEngine;
namespace NodeCanvas.Tasks.Conditions
{
[Name("Target In View Angle")]
[Category("GameObject")]
[Description("Checks whether the target is in the view angle of the agent")]
public class IsInFront : ConditionTask<Transform>
{
[RequiredField]
public BBParameter<GameObject> checkTarget;
[SliderField(1, 180)]
public BBParameter<float> viewAngle = 70f;
protected override string info {
get { return checkTarget + " in view angle"; }
}
protected override bool OnCheck() {
return Vector3.Angle(checkTarget.value.transform.position - agent.position, agent.forward) < viewAngle.value;
}
public override void OnDrawGizmosSelected() {
if ( agent != null ) {
Gizmos.matrix = Matrix4x4.TRS(agent.position, agent.rotation, Vector3.one);
Gizmos.DrawFrustum(Vector3.zero, viewAngle.value, 5, 0, 1f);
}
}
}
}

View File

@@ -0,0 +1,15 @@
fileFormatVersion: 2
guid: e1a0f56b2c92a024b906e2a67a8d5aff
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
AssetOrigin:
serializedVersion: 1
productId: 14914
packageName: NodeCanvas
packageVersion: 3.3.1
assetPath: Assets/ParadoxNotion/NodeCanvas/Tasks/Conditions/GameObject/IsInFront.cs
uploadId: 704937

View File

@@ -0,0 +1,36 @@
using NodeCanvas.Framework;
using ParadoxNotion.Design;
using UnityEngine;
namespace NodeCanvas.Tasks.Conditions
{
[Name("Target In View Angle 2D")]
[Category("GameObject")]
[Description("Checks whether the target is in the view angle of the agent")]
public class IsInFront2D : ConditionTask<Transform>
{
[RequiredField]
public BBParameter<GameObject> checkTarget;
[SliderField(1, 180)]
public BBParameter<float> viewAngle = 70f;
protected override string info {
get { return checkTarget + " in view angle"; }
}
protected override bool OnCheck() {
return Vector2.Angle((Vector2)checkTarget.value.transform.position - (Vector2)agent.position, agent.right) < viewAngle.value;
}
public override void OnDrawGizmosSelected() {
if ( agent != null ) {
Gizmos.matrix = Matrix4x4.TRS((Vector2)agent.position, agent.rotation, Vector3.one);
Gizmos.DrawFrustum(Vector3.zero, viewAngle.value, 5, 0, 0f);
}
}
}
}

View File

@@ -0,0 +1,15 @@
fileFormatVersion: 2
guid: 69e73532523d4a042aa4faa4f01fecde
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
AssetOrigin:
serializedVersion: 1
productId: 14914
packageName: NodeCanvas
packageVersion: 3.3.1
assetPath: Assets/ParadoxNotion/NodeCanvas/Tasks/Conditions/GameObject/IsInFront2D.cs
uploadId: 704937

View File

@@ -0,0 +1,19 @@
using NodeCanvas.Framework;
using ParadoxNotion.Design;
using UnityEngine;
namespace NodeCanvas.Tasks.Conditions
{
[Category("GameObject")]
public class IsWithinLayerMask : ConditionTask<Transform>
{
public BBParameter<LayerMask> targetLayers;
protected override bool OnCheck() {
return ParadoxNotion.ObjectUtils.IsInLayerMask(agent.gameObject, targetLayers.value);
}
}
}

View File

@@ -0,0 +1,15 @@
fileFormatVersion: 2
guid: 8421a25f60933284e97c3b05827cc14f
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
AssetOrigin:
serializedVersion: 1
productId: 14914
packageName: NodeCanvas
packageVersion: 3.3.1
assetPath: Assets/ParadoxNotion/NodeCanvas/Tasks/Conditions/GameObject/IsWithinLayerMask.cs
uploadId: 704937