67 lines
1.7 KiB
C#
67 lines
1.7 KiB
C#
using NodeCanvas.Framework;
|
|
using ParadoxNotion.Design;
|
|
using UnityEngine;
|
|
|
|
|
|
namespace Reset.Units {
|
|
|
|
[Category("Reset/Movement")]
|
|
[Description("Fetch and save various parts of the movement data")]
|
|
public class GetResolvedMovementData : ActionTask<UnitMovementHandler>{
|
|
public BBParameter<Vector2> resolvedVector2;
|
|
public BBParameter<Vector3> resolvedVector3;
|
|
public BBParameter<float> resolvedGravity;
|
|
public BBParameter<float> resolvedSpeed;
|
|
public BBParameter<Quaternion> resolvedRotation;
|
|
|
|
//Use for initialization. This is called only once in the lifetime of the task.
|
|
//Return null if init was successfull. Return an error string otherwise
|
|
protected override string OnInit() {
|
|
return null;
|
|
}
|
|
|
|
//This is called once each time the task is enabled.
|
|
//Call EndAction() to mark the action as finished, either in success or failure.
|
|
//EndAction can be called from anywhere.
|
|
protected override void OnExecute() {
|
|
|
|
|
|
|
|
}
|
|
|
|
//Called once per frame while the action is active.
|
|
protected override void OnUpdate() {
|
|
if (resolvedVector2.isDefined) {
|
|
resolvedVector2.value = agent.GetResolvedDirection();
|
|
}
|
|
|
|
if (resolvedVector3.isDefined) {
|
|
resolvedVector3.value = agent.GetResolvedDirection().ToVector3();
|
|
}
|
|
|
|
if (resolvedGravity.isDefined) {
|
|
resolvedGravity.value = agent.GetResolvedGravity();
|
|
}
|
|
|
|
if (resolvedSpeed.isDefined) {
|
|
resolvedSpeed.value = agent.GetResolvedSpeed();
|
|
}
|
|
|
|
if (resolvedRotation.isDefined) {
|
|
resolvedRotation.value = agent.GetResolvedRotation();
|
|
}
|
|
|
|
EndAction(true);
|
|
}
|
|
|
|
//Called when the task is disabled.
|
|
protected override void OnStop() {
|
|
|
|
}
|
|
|
|
//Called when the task is paused.
|
|
protected override void OnPause() {
|
|
|
|
}
|
|
}
|
|
} |