first commit
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
using NodeCanvas.Framework;
|
||||
using ParadoxNotion.Design;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
namespace NodeCanvas.Tasks.Actions
|
||||
{
|
||||
|
||||
[Name("Play Animation")]
|
||||
[Category("Animator")]
|
||||
public class MecanimPlayAnimation : ActionTask<Animator>
|
||||
{
|
||||
|
||||
public BBParameter<int> layerIndex;
|
||||
[RequiredField]
|
||||
public BBParameter<string> stateName;
|
||||
[SliderField(0, 1)]
|
||||
public float transitTime = 0.25f;
|
||||
public bool waitUntilFinish;
|
||||
|
||||
private AnimatorStateInfo stateInfo;
|
||||
private bool played;
|
||||
|
||||
protected override string info {
|
||||
get { return "Anim '" + stateName.ToString() + "'"; }
|
||||
}
|
||||
|
||||
protected override void OnExecute() {
|
||||
if ( string.IsNullOrEmpty(stateName.value) ) {
|
||||
EndAction();
|
||||
return;
|
||||
}
|
||||
played = false;
|
||||
var current = agent.GetCurrentAnimatorStateInfo(layerIndex.value);
|
||||
agent.CrossFade(stateName.value, transitTime / current.length, layerIndex.value, 0, 0);
|
||||
}
|
||||
|
||||
protected override void OnUpdate() {
|
||||
|
||||
stateInfo = agent.GetCurrentAnimatorStateInfo(layerIndex.value);
|
||||
|
||||
if ( waitUntilFinish ) {
|
||||
|
||||
if ( stateInfo.IsName(stateName.value) ) {
|
||||
|
||||
played = true;
|
||||
if ( elapsedTime >= ( stateInfo.length / agent.speed ) ) {
|
||||
EndAction();
|
||||
}
|
||||
|
||||
} else if ( played ) {
|
||||
|
||||
EndAction();
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if ( elapsedTime >= transitTime ) {
|
||||
EndAction();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 068de04d6f321674f8df75b0e7799e08
|
||||
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/Animator/MecanimPlayAnimation.cs
|
||||
uploadId: 704937
|
||||
@@ -0,0 +1,32 @@
|
||||
using NodeCanvas.Framework;
|
||||
using ParadoxNotion.Design;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
namespace NodeCanvas.Tasks.Actions
|
||||
{
|
||||
|
||||
[Name("Set Parameter Bool")]
|
||||
[Category("Animator")]
|
||||
[Description("You can either use a parameter name OR hashID. Leave the parameter name empty or none to use hashID instead.")]
|
||||
public class MecanimSetBool : ActionTask<Animator>
|
||||
{
|
||||
|
||||
public BBParameter<string> parameter;
|
||||
public BBParameter<int> parameterHashID;
|
||||
public BBParameter<bool> setTo;
|
||||
|
||||
protected override string info {
|
||||
get { return string.Format("Mec.SetBool {0} to {1}", string.IsNullOrEmpty(parameter.value) && !parameter.useBlackboard ? parameterHashID.ToString() : parameter.ToString(), setTo); }
|
||||
}
|
||||
|
||||
protected override void OnExecute() {
|
||||
if ( !string.IsNullOrEmpty(parameter.value) ) {
|
||||
agent.SetBool(parameter.value, setTo.value);
|
||||
} else {
|
||||
agent.SetBool(parameterHashID.value, setTo.value);
|
||||
}
|
||||
EndAction(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3b4b5555c43840447a0a5bf21924e8b0
|
||||
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/Animator/MecanimSetBool.cs
|
||||
uploadId: 704937
|
||||
@@ -0,0 +1,61 @@
|
||||
using NodeCanvas.Framework;
|
||||
using ParadoxNotion.Design;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
namespace NodeCanvas.Tasks.Actions
|
||||
{
|
||||
|
||||
[Name("Set Parameter Float")]
|
||||
[Category("Animator")]
|
||||
[Description("You can either use a parameter name OR hashID. Leave the parameter name empty or none to use hashID instead.")]
|
||||
public class MecanimSetFloat : ActionTask<Animator>
|
||||
{
|
||||
|
||||
public BBParameter<string> parameter;
|
||||
public BBParameter<int> parameterHashID;
|
||||
public BBParameter<float> setTo;
|
||||
[SliderField(0, 1)]
|
||||
public float transitTime = 0.25f;
|
||||
|
||||
private float currentValue;
|
||||
|
||||
protected override string info {
|
||||
get { return string.Format("Mec.SetFloat {0} to {1}", string.IsNullOrEmpty(parameter.value) && !parameter.useBlackboard ? parameterHashID.ToString() : parameter.ToString(), setTo); }
|
||||
}
|
||||
|
||||
|
||||
protected override void OnExecute() {
|
||||
|
||||
if ( transitTime <= 0 ) {
|
||||
Set(setTo.value);
|
||||
EndAction();
|
||||
return;
|
||||
}
|
||||
|
||||
currentValue = Get();
|
||||
}
|
||||
|
||||
protected override void OnUpdate() {
|
||||
Set(Mathf.Lerp(currentValue, setTo.value, elapsedTime / transitTime));
|
||||
if ( elapsedTime >= transitTime ) {
|
||||
EndAction(true);
|
||||
}
|
||||
}
|
||||
|
||||
float Get() {
|
||||
if ( !string.IsNullOrEmpty(parameter.value) ) {
|
||||
return agent.GetFloat(parameter.value);
|
||||
}
|
||||
return agent.GetFloat(parameterHashID.value);
|
||||
}
|
||||
|
||||
void Set(float newValue) {
|
||||
if ( !string.IsNullOrEmpty(parameter.value) ) {
|
||||
agent.SetFloat(parameter.value, newValue);
|
||||
return;
|
||||
}
|
||||
agent.SetFloat(parameterHashID.value, newValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 81ea6c2dce41d5649a91981c87313f37
|
||||
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/Animator/MecanimSetFloat.cs
|
||||
uploadId: 704937
|
||||
@@ -0,0 +1,37 @@
|
||||
using NodeCanvas.Framework;
|
||||
using ParadoxNotion.Design;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
namespace NodeCanvas.Tasks.Actions
|
||||
{
|
||||
|
||||
[Name("Set IK")]
|
||||
[Category("Animator")]
|
||||
public class MecanimSetIK : ActionTask<Animator>
|
||||
{
|
||||
|
||||
public AvatarIKGoal IKGoal;
|
||||
[RequiredField]
|
||||
public BBParameter<GameObject> goal;
|
||||
public BBParameter<float> weight;
|
||||
|
||||
protected override string info {
|
||||
get { return "Set '" + IKGoal + "' " + goal; }
|
||||
}
|
||||
|
||||
protected override void OnExecute() {
|
||||
router.onAnimatorIK += OnAnimatorIK;
|
||||
}
|
||||
|
||||
protected override void OnStop() {
|
||||
router.onAnimatorIK -= OnAnimatorIK;
|
||||
}
|
||||
|
||||
void OnAnimatorIK(ParadoxNotion.EventData<int> msg) {
|
||||
agent.SetIKPositionWeight(IKGoal, weight.value);
|
||||
agent.SetIKPosition(IKGoal, goal.value.transform.position);
|
||||
EndAction();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6aa8269a954781a40a72e0ab09b42ebd
|
||||
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/Animator/MecanimSetIK.cs
|
||||
uploadId: 704937
|
||||
@@ -0,0 +1,32 @@
|
||||
using NodeCanvas.Framework;
|
||||
using ParadoxNotion.Design;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
namespace NodeCanvas.Tasks.Actions
|
||||
{
|
||||
|
||||
[Name("Set Parameter Integer")]
|
||||
[Category("Animator")]
|
||||
[Description("You can either use a parameter name OR hashID. Leave the parameter name empty or none to use hashID instead.")]
|
||||
public class MecanimSetInt : ActionTask<Animator>
|
||||
{
|
||||
|
||||
public BBParameter<string> parameter;
|
||||
public BBParameter<int> parameterHashID;
|
||||
public BBParameter<int> setTo;
|
||||
|
||||
protected override string info {
|
||||
get { return string.Format("Mec.SetInt {0} to {1}", string.IsNullOrEmpty(parameter.value) && !parameter.useBlackboard ? parameterHashID.ToString() : parameter.ToString(), setTo); }
|
||||
}
|
||||
|
||||
protected override void OnExecute() {
|
||||
if ( !string.IsNullOrEmpty(parameter.value) ) {
|
||||
agent.SetInteger(parameter.value, setTo.value);
|
||||
} else {
|
||||
agent.SetInteger(parameterHashID.value, setTo.value);
|
||||
}
|
||||
EndAction();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fe51923d669e70d48b6154e408605923
|
||||
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/Animator/MecanimSetInt.cs
|
||||
uploadId: 704937
|
||||
@@ -0,0 +1,42 @@
|
||||
using NodeCanvas.Framework;
|
||||
using ParadoxNotion.Design;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
namespace NodeCanvas.Tasks.Actions
|
||||
{
|
||||
|
||||
[Name("Set Layer Weight")]
|
||||
[Category("Animator")]
|
||||
public class MecanimSetLayerWeight : ActionTask<Animator>
|
||||
{
|
||||
|
||||
public BBParameter<int> layerIndex;
|
||||
|
||||
[SliderField(0, 1)]
|
||||
public BBParameter<float> layerWeight;
|
||||
|
||||
[SliderField(0, 1)]
|
||||
public float transitTime;
|
||||
|
||||
private float currentValue;
|
||||
|
||||
protected override string info {
|
||||
get { return "Set Layer " + layerIndex + ", weight " + layerWeight; }
|
||||
}
|
||||
|
||||
protected override void OnExecute() {
|
||||
|
||||
currentValue = agent.GetLayerWeight(layerIndex.value);
|
||||
}
|
||||
|
||||
protected override void OnUpdate() {
|
||||
var norm = transitTime > 0f ? Mathf.Lerp(currentValue, layerWeight.value, elapsedTime / transitTime) : layerWeight.value;
|
||||
agent.SetLayerWeight(layerIndex.value, norm);
|
||||
|
||||
if ( elapsedTime >= transitTime ) {
|
||||
EndAction(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c6f88c3bb281ccf469df8a20555329cf
|
||||
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/Animator/MecanimSetLayerWeight.cs
|
||||
uploadId: 704937
|
||||
@@ -0,0 +1,35 @@
|
||||
using NodeCanvas.Framework;
|
||||
using ParadoxNotion.Design;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
namespace NodeCanvas.Tasks.Actions
|
||||
{
|
||||
|
||||
[Name("Set Look At")]
|
||||
[Category("Animator")]
|
||||
public class MecanimSetLookAt : ActionTask<Animator>
|
||||
{
|
||||
|
||||
public BBParameter<GameObject> targetPosition;
|
||||
public BBParameter<float> targetWeight;
|
||||
|
||||
protected override string info {
|
||||
get { return "Mec.SetLookAt " + targetPosition; }
|
||||
}
|
||||
|
||||
protected override void OnExecute() {
|
||||
router.onAnimatorIK += OnAnimatorIK;
|
||||
}
|
||||
|
||||
protected override void OnStop() {
|
||||
router.onAnimatorIK -= OnAnimatorIK;
|
||||
}
|
||||
|
||||
void OnAnimatorIK(ParadoxNotion.EventData<int> msg) {
|
||||
agent.SetLookAtPosition(targetPosition.value.transform.position);
|
||||
agent.SetLookAtWeight(targetWeight.value);
|
||||
EndAction();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5ba868e9fed5f284c9cfac8f2aa92a73
|
||||
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/Animator/MecanimSetLookAt.cs
|
||||
uploadId: 704937
|
||||
@@ -0,0 +1,31 @@
|
||||
using NodeCanvas.Framework;
|
||||
using ParadoxNotion.Design;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
namespace NodeCanvas.Tasks.Actions
|
||||
{
|
||||
|
||||
[Name("Set Parameter Trigger")]
|
||||
[Category("Animator")]
|
||||
[Description("You can either use a parameter name OR hashID. Leave the parameter name empty or none to use hashID instead.")]
|
||||
public class MecanimSetTrigger : ActionTask<Animator>
|
||||
{
|
||||
|
||||
public BBParameter<string> parameter;
|
||||
public BBParameter<int> parameterHashID;
|
||||
|
||||
protected override string info {
|
||||
get { return string.Format("Mec.SetTrigger {0}", string.IsNullOrEmpty(parameter.value) && !parameter.useBlackboard ? parameterHashID.ToString() : parameter.ToString()); }
|
||||
}
|
||||
|
||||
protected override void OnExecute() {
|
||||
if ( !string.IsNullOrEmpty(parameter.value) ) {
|
||||
agent.SetTrigger(parameter.value);
|
||||
} else {
|
||||
agent.SetTrigger(parameterHashID.value);
|
||||
}
|
||||
EndAction();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 755b04421778adb43ab33691892beed5
|
||||
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/Animator/MecanimSetTrigger.cs
|
||||
uploadId: 704937
|
||||
Reference in New Issue
Block a user