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,46 @@
using NodeCanvas.Framework;
using ParadoxNotion.Design;
using UnityEngine;
namespace NodeCanvas.Tasks.Actions
{
[Category("Physics")]
public class GetLinecastInfo : ActionTask<Transform>
{
[RequiredField]
public BBParameter<GameObject> target;
public BBParameter<LayerMask> layerMask = (LayerMask)( -1 );
[BlackboardOnly]
public BBParameter<GameObject> saveHitGameObjectAs;
[BlackboardOnly]
public BBParameter<float> saveDistanceAs;
[BlackboardOnly]
public BBParameter<Vector3> savePointAs;
[BlackboardOnly]
public BBParameter<Vector3> saveNormalAs;
private RaycastHit hit = new RaycastHit();
protected override void OnExecute() {
if ( Physics.Linecast(agent.position, target.value.transform.position, out hit, layerMask.value) ) {
saveHitGameObjectAs.value = hit.collider.gameObject;
saveDistanceAs.value = hit.distance;
savePointAs.value = hit.point;
saveNormalAs.value = hit.normal;
EndAction(true);
return;
}
EndAction(false);
}
public override void OnDrawGizmosSelected() {
if ( agent && target.value )
Gizmos.DrawLine(agent.position, target.value.transform.position);
}
}
}

View File

@@ -0,0 +1,15 @@
fileFormatVersion: 2
guid: 77e312cf4d4d43647b0b6fab0d9f4c7f
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/Actions/Physics/GetLinecastInfo.cs
uploadId: 704937

View File

@@ -0,0 +1,48 @@
using NodeCanvas.Framework;
using ParadoxNotion.Design;
using UnityEngine;
namespace NodeCanvas.Tasks.Actions
{
[Category("Physics")]
public class GetLinecastInfo2D : ActionTask<Transform>
{
[RequiredField]
public BBParameter<GameObject> target;
public LayerMask mask = -1;
[BlackboardOnly]
public BBParameter<GameObject> saveHitGameObjectAs;
[BlackboardOnly]
public BBParameter<float> saveDistanceAs;
[BlackboardOnly]
public BBParameter<Vector3> savePointAs;
[BlackboardOnly]
public BBParameter<Vector3> saveNormalAs;
private RaycastHit2D hit;
protected override void OnExecute() {
hit = Physics2D.Linecast(agent.position, target.value.transform.position, mask);
if ( hit.collider != null ) {
saveHitGameObjectAs.value = hit.collider.gameObject;
saveDistanceAs.value = hit.fraction;
savePointAs.value = hit.point;
saveNormalAs.value = hit.normal;
EndAction(true);
return;
}
EndAction(false);
}
public override void OnDrawGizmosSelected() {
if ( agent && target.value )
Gizmos.DrawLine(agent.position, target.value.transform.position);
}
}
}

View File

@@ -0,0 +1,15 @@
fileFormatVersion: 2
guid: 81c25b4dcbec2a842975669ee60fbd04
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/Actions/Physics/GetLinecastInfo2D.cs
uploadId: 704937

View File

@@ -0,0 +1,51 @@
using System.Collections.Generic;
using System.Linq;
using NodeCanvas.Framework;
using ParadoxNotion.Design;
using UnityEngine;
namespace NodeCanvas.Tasks.Actions
{
[Category("Physics")]
[Description("Get hit info for ALL objects in the linecast, in Lists")]
public class GetLinecastInfo2DAll : ActionTask<Transform>
{
[RequiredField]
public BBParameter<GameObject> target;
public LayerMask mask = -1;
[BlackboardOnly]
public BBParameter<List<GameObject>> saveHitGameObjectsAs;
[BlackboardOnly]
public BBParameter<List<float>> saveDistancesAs;
[BlackboardOnly]
public BBParameter<List<Vector3>> savePointsAs;
[BlackboardOnly]
public BBParameter<List<Vector3>> saveNormalsAs;
private RaycastHit2D[] hits;
protected override void OnExecute() {
hits = Physics2D.LinecastAll(agent.position, target.value.transform.position, mask);
if ( hits.Length > 0 ) {
saveHitGameObjectsAs.value = hits.Select(h => h.collider.gameObject).ToList();
saveDistancesAs.value = hits.Select(h => h.fraction).ToList();
savePointsAs.value = hits.Select(h => new Vector3(h.point.x, h.point.y, target.value.transform.position.z)).ToList();
saveNormalsAs.value = hits.Select(h => new Vector3(h.normal.x, h.normal.y, 0f)).ToList();
EndAction(true);
return;
}
EndAction(false);
}
public override void OnDrawGizmosSelected() {
if ( agent && target.value )
Gizmos.DrawLine(agent.position, target.value.transform.position);
}
}
}

View File

@@ -0,0 +1,15 @@
fileFormatVersion: 2
guid: 9e07c52f3f651ff4c838b8ab8344b14e
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/Actions/Physics/GetLinecastInfo2DAll.cs
uploadId: 704937

View File

@@ -0,0 +1,42 @@
using System.Collections.Generic;
using System.Linq;
using NodeCanvas.Framework;
using ParadoxNotion.Design;
using UnityEngine;
namespace NodeCanvas.Tasks.Actions
{
[Category("Physics")]
[Description("Gets a lists of game objects that are in the physics overlap sphere at the position of the agent, excluding the agent")]
public class GetOverlapSphereObjects : ActionTask<Transform>
{
public LayerMask layerMask = -1;
public BBParameter<float> radius = 2;
[BlackboardOnly]
public BBParameter<List<GameObject>> saveObjectsAs;
protected override void OnExecute() {
var hitColliders = Physics.OverlapSphere(agent.position, radius.value, layerMask);
saveObjectsAs.value = hitColliders.Select(c => c.gameObject).ToList();
saveObjectsAs.value.Remove(agent.gameObject);
if ( saveObjectsAs.value.Count == 0 ) {
EndAction(false);
return;
}
EndAction(true);
}
public override void OnDrawGizmosSelected() {
if ( agent != null ) {
Gizmos.color = new Color(1, 1, 1, 0.2f);
Gizmos.DrawSphere(agent.position, radius.value);
}
}
}
}

View File

@@ -0,0 +1,15 @@
fileFormatVersion: 2
guid: 08a365a29ed52284bae6255b4952440f
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/Actions/Physics/GetOverlapSphereObjects.cs
uploadId: 704937