change: more alterations to movement, settingvalues, valuegroup, etc.
This commit is contained in:
@@ -1,19 +1,21 @@
|
||||
using System;
|
||||
using NodeCanvas.Framework;
|
||||
using ParadoxNotion.Design;
|
||||
using Reset.Core;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
namespace Reset.Units {
|
||||
|
||||
[Category("Reset/Movement")]
|
||||
public class ChangeGravitySettings : ActionTask<UnitMovementHandler>{
|
||||
public FloatValueGroup jumpPower = new FloatValueGroup("Jump Power");
|
||||
public FloatValueGroup jumpPowerDecay = new FloatValueGroup("Jump Power Decay");
|
||||
[SerializeField] public FloatValueGroup jumpPower = new FloatValueGroup("Jump Power");
|
||||
[SerializeField] public FloatValueGroup jumpPowerDecay = new FloatValueGroup("Jump Power Decay");
|
||||
|
||||
public FloatValueGroup gravityPower = new FloatValueGroup("Jump Power");
|
||||
public FloatValueGroup gravityMax = new FloatValueGroup("Jump Power");
|
||||
public FloatValueGroup gravityAcceleration = new FloatValueGroup("Jump Power");
|
||||
public FloatValueGroup gravityScale = new FloatValueGroup("Jump Power");
|
||||
[SerializeField] public FloatValueGroup gravityPower = new FloatValueGroup("Gravity Power");
|
||||
[SerializeField] public FloatValueGroup gravityMax = new FloatValueGroup("Gravity Max");
|
||||
[SerializeField] public FloatValueGroup gravityAcceleration = new FloatValueGroup("Gravity Acceleration");
|
||||
[SerializeField] public FloatValueGroup gravityScale = new FloatValueGroup("Gravity Scale");
|
||||
|
||||
//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
|
||||
@@ -26,14 +28,30 @@ namespace Reset.Units {
|
||||
//EndAction can be called from anywhere.
|
||||
protected override void OnExecute() {
|
||||
// Jump
|
||||
FloatValueGroup.UpdateValue(jumpPower, ref agent.data.jumpPower, ref agent.defaultData.jumpPower);
|
||||
FloatValueGroup.UpdateValue(jumpPowerDecay, ref agent.data.jumpPowerDecay, ref agent.defaultData.jumpPowerDecay);
|
||||
FloatValueGroup.UpdateValue(jumpPower, ref agent.data.jumpPower.value, ref agent.defaultData.jumpPower.value);
|
||||
ValueGroup.ChangeSmoothingEasing(jumpPower, ref agent.data.jumpPower.currentSmoothing,
|
||||
ref agent.data.jumpPower.easing, ref agent.defaultData.jumpPower.smoothing, ref agent.defaultData.jumpPower.easing);
|
||||
|
||||
FloatValueGroup.UpdateValue(jumpPowerDecay, ref agent.data.jumpPowerDecay.value, ref agent.defaultData.jumpPowerDecay.value);
|
||||
ValueGroup.ChangeSmoothingEasing(jumpPowerDecay, ref agent.data.jumpPowerDecay.currentSmoothing,
|
||||
ref agent.data.jumpPowerDecay.easing, ref agent.defaultData.jumpPowerDecay.smoothing, ref agent.defaultData.jumpPowerDecay.easing);
|
||||
|
||||
// Gravity
|
||||
FloatValueGroup.UpdateValue(gravityPower, ref agent.data.gravityPower, ref agent.defaultData.gravityPower);
|
||||
FloatValueGroup.UpdateValue(gravityMax, ref agent.data.gravityMax, ref agent.defaultData.gravityMax);
|
||||
FloatValueGroup.UpdateValue(gravityAcceleration, ref agent.data.gravityAcceleration, ref agent.defaultData.gravityAcceleration);
|
||||
FloatValueGroup.UpdateValue(gravityScale, ref agent.data.gravityScale, ref agent.defaultData.gravityScale);
|
||||
FloatValueGroup.UpdateValue(gravityPower, ref agent.data.gravityPower.value, ref agent.defaultData.gravityPower.value);
|
||||
ValueGroup.ChangeSmoothingEasing(gravityPower, ref agent.data.gravityPower.currentSmoothing,
|
||||
ref agent.data.gravityPower.easing, ref agent.defaultData.gravityPower.smoothing, ref agent.defaultData.gravityPower.easing);
|
||||
|
||||
FloatValueGroup.UpdateValue(gravityMax, ref agent.data.gravityMax.value, ref agent.defaultData.gravityMax.value);
|
||||
ValueGroup.ChangeSmoothingEasing(gravityMax, ref agent.data.gravityMax.currentSmoothing,
|
||||
ref agent.data.gravityMax.easing, ref agent.defaultData.gravityMax.smoothing, ref agent.defaultData.gravityMax.easing);
|
||||
|
||||
FloatValueGroup.UpdateValue(gravityAcceleration, ref agent.data.gravityAcceleration.value, ref agent.defaultData.gravityAcceleration.value);
|
||||
ValueGroup.ChangeSmoothingEasing(gravityAcceleration, ref agent.data.gravityAcceleration.currentSmoothing,
|
||||
ref agent.data.gravityAcceleration.easing, ref agent.defaultData.gravityAcceleration.smoothing, ref agent.defaultData.gravityAcceleration.easing);
|
||||
|
||||
FloatValueGroup.UpdateValue(gravityScale, ref agent.data.gravityScale.value, ref agent.defaultData.gravityScale.value);
|
||||
ValueGroup.ChangeSmoothingEasing(gravityScale, ref agent.data.gravityScale.currentSmoothing,
|
||||
ref agent.data.gravityScale.easing, ref agent.defaultData.gravityScale.smoothing, ref agent.defaultData.gravityScale.easing);
|
||||
}
|
||||
|
||||
//Called once per frame while the action is active.
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
using NodeCanvas.Framework;
|
||||
using ParadoxNotion.Design;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
namespace Reset.Units {
|
||||
|
||||
[Category("Reset/Movement")]
|
||||
[Description("Sets a new value for gravity. Additively, or absolutely.")]
|
||||
public class SetNewGravity : ActionTask<UnitMovementHandler>{
|
||||
|
||||
public BBParameter<float> newGravity;
|
||||
[Tooltip("Setting absolute to true will cause the current gravity to snap to the new gravity value. Keeping it false will make it apply additively to the current gravity. Both options use relativty for linear interpolation.")]
|
||||
public BBParameter<bool> absolute;
|
||||
[SliderField(0, 1)]
|
||||
public BBParameter<float> relativity;
|
||||
|
||||
//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() {
|
||||
agent.SetNewGravity(newGravity.value, relativity.value, absolute.value);
|
||||
EndAction(true);
|
||||
}
|
||||
|
||||
//Called once per frame while the action is active.
|
||||
protected override void OnUpdate() {
|
||||
|
||||
}
|
||||
|
||||
//Called when the task is disabled.
|
||||
protected override void OnStop() {
|
||||
|
||||
}
|
||||
|
||||
//Called when the task is paused.
|
||||
protected override void OnPause() {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ebaf22f2865425e4c8f10f444ae83c21
|
||||
Reference in New Issue
Block a user