first commit
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
using NodeCanvas.Framework;
|
||||
using ParadoxNotion;
|
||||
using ParadoxNotion.Design;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
namespace NodeCanvas.Tasks.Conditions
|
||||
{
|
||||
|
||||
[Category("Input (Legacy System)")]
|
||||
public class CheckButtonInput : ConditionTask
|
||||
{
|
||||
|
||||
public PressTypes pressType = PressTypes.Down;
|
||||
[RequiredField] public BBParameter<string> buttonName = "Fire1";
|
||||
|
||||
protected override string info {
|
||||
get { return pressType.ToString() + " " + buttonName.ToString(); }
|
||||
}
|
||||
|
||||
protected override bool OnCheck() {
|
||||
|
||||
if ( pressType == PressTypes.Down )
|
||||
return Input.GetButtonDown(buttonName.value);
|
||||
|
||||
if ( pressType == PressTypes.Up )
|
||||
return Input.GetButtonUp(buttonName.value);
|
||||
|
||||
if ( pressType == PressTypes.Pressed )
|
||||
return Input.GetButton(buttonName.value);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 53529c5c403f06249ba9be1abcd1241b
|
||||
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/Input/CheckButtonInput.cs
|
||||
uploadId: 704937
|
||||
@@ -0,0 +1,50 @@
|
||||
using NodeCanvas.Framework;
|
||||
using ParadoxNotion;
|
||||
using ParadoxNotion.Design;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
namespace NodeCanvas.Tasks.Conditions
|
||||
{
|
||||
|
||||
[Category("Input (Legacy System)")]
|
||||
public class CheckKeyboardInput : ConditionTask
|
||||
{
|
||||
|
||||
public PressTypes pressType = PressTypes.Down;
|
||||
public KeyCode key = KeyCode.Space;
|
||||
|
||||
protected override string info {
|
||||
get { return pressType.ToString() + " " + key.ToString(); }
|
||||
}
|
||||
|
||||
protected override bool OnCheck() {
|
||||
|
||||
if ( pressType == PressTypes.Down )
|
||||
return Input.GetKeyDown(key);
|
||||
|
||||
if ( pressType == PressTypes.Up )
|
||||
return Input.GetKeyUp(key);
|
||||
|
||||
if ( pressType == PressTypes.Pressed )
|
||||
return Input.GetKey(key);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
///----------------------------------------------------------------------------------------------
|
||||
///---------------------------------------UNITY EDITOR-------------------------------------------
|
||||
#if UNITY_EDITOR
|
||||
|
||||
protected override void OnTaskInspectorGUI() {
|
||||
|
||||
UnityEditor.EditorGUILayout.BeginHorizontal();
|
||||
pressType = (PressTypes)UnityEditor.EditorGUILayout.EnumPopup(pressType);
|
||||
key = (KeyCode)UnityEditor.EditorGUILayout.EnumPopup(key);
|
||||
UnityEditor.EditorGUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e79b7a152baaffc48842942208d33a61
|
||||
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/Input/CheckKeyboardInput.cs
|
||||
uploadId: 704937
|
||||
@@ -0,0 +1,47 @@
|
||||
using NodeCanvas.Framework;
|
||||
using ParadoxNotion.Design;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
namespace NodeCanvas.Tasks.Conditions
|
||||
{
|
||||
|
||||
[Category("Input (Legacy System)")]
|
||||
public class CheckMousePick : ConditionTask
|
||||
{
|
||||
|
||||
public ParadoxNotion.ButtonKeys buttonKey;
|
||||
[LayerField] public int layer;
|
||||
|
||||
[BlackboardOnly] public BBParameter<GameObject> saveGoAs;
|
||||
[BlackboardOnly] public BBParameter<float> saveDistanceAs;
|
||||
[BlackboardOnly] public BBParameter<Vector3> savePosAs;
|
||||
|
||||
private RaycastHit hit;
|
||||
|
||||
protected override string info {
|
||||
get
|
||||
{
|
||||
var finalString = buttonKey.ToString() + " Click";
|
||||
if ( !string.IsNullOrEmpty(savePosAs.name) )
|
||||
finalString += string.Format("\n<i>(SavePos As {0})</i>", savePosAs);
|
||||
if ( !string.IsNullOrEmpty(saveGoAs.name) )
|
||||
finalString += string.Format("\n<i>(SaveGo As {0})</i>", saveGoAs);
|
||||
return finalString;
|
||||
}
|
||||
}
|
||||
|
||||
protected override bool OnCheck() {
|
||||
|
||||
if ( Input.GetMouseButtonDown((int)buttonKey) ) {
|
||||
if ( Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hit, Mathf.Infinity, 1 << layer) ) {
|
||||
saveGoAs.value = hit.collider.gameObject;
|
||||
saveDistanceAs.value = hit.distance;
|
||||
savePosAs.value = hit.point;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6e9a62bf60417864c88657b1f39943d6
|
||||
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/Input/CheckMousePick.cs
|
||||
uploadId: 704937
|
||||
@@ -0,0 +1,51 @@
|
||||
using NodeCanvas.Framework;
|
||||
using ParadoxNotion.Design;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
namespace NodeCanvas.Tasks.Conditions
|
||||
{
|
||||
|
||||
[Category("Input (Legacy System)")]
|
||||
public class CheckMousePick2D : ConditionTask
|
||||
{
|
||||
|
||||
public ParadoxNotion.ButtonKeys buttonKey;
|
||||
public LayerMask mask = -1;
|
||||
|
||||
[BlackboardOnly] public BBParameter<GameObject> saveGoAs;
|
||||
[BlackboardOnly] public BBParameter<float> saveDistanceAs;
|
||||
[BlackboardOnly] public BBParameter<Vector3> savePosAs;
|
||||
|
||||
private int buttonID;
|
||||
private RaycastHit2D hit;
|
||||
|
||||
protected override string info {
|
||||
get
|
||||
{
|
||||
var finalString = buttonKey.ToString() + " Click";
|
||||
if ( !savePosAs.isNone )
|
||||
finalString += "\nSavePos As " + savePosAs;
|
||||
if ( !saveGoAs.isNone )
|
||||
finalString += "\nSaveGo As " + saveGoAs;
|
||||
return finalString;
|
||||
}
|
||||
}
|
||||
|
||||
protected override bool OnCheck() {
|
||||
|
||||
buttonID = (int)buttonKey;
|
||||
if ( Input.GetMouseButtonDown(buttonID) ) {
|
||||
var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
|
||||
hit = Physics2D.Raycast(ray.origin, ray.direction, Mathf.Infinity, mask);
|
||||
if ( hit.collider != null ) {
|
||||
savePosAs.value = hit.point;
|
||||
saveGoAs.value = hit.collider.gameObject;
|
||||
saveDistanceAs.value = hit.distance;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f04e747aff6b43548b88a0733c254fff
|
||||
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/Input/CheckMousePick2D.cs
|
||||
uploadId: 704937
|
||||
Reference in New Issue
Block a user