change: finished and cleaned all settings changes, code commented, smoothing and easing are now exponential

This commit is contained in:
Chris
2025-09-26 14:03:11 -04:00
parent bd2903a0b2
commit 4569cea664
20 changed files with 676 additions and 399 deletions

View File

@@ -10,15 +10,9 @@ namespace Reset.Units {
public class ChangeDirectionSettings : ActionTask<UnitMovementHandler> {
// Direction
[Space(5)]
public Vector3ValueGroup feedNewDirection = new Vector3ValueGroup("Feed New Direction");
public float newDirectionStrength;
[Space(5)]
public Vector2 addDirectionFromInput;
public float addInputStrength;
[SliderField(0,1)]
public float addInputPriorty;
public FloatValueGroup directionSmoothing = new FloatValueGroup("Direction Smoothing");
public FloatValueGroup directionChangingSoftness = new FloatValueGroup("Direction Changing Softness");
public FloatValueGroup directionSpinningHardness = new FloatValueGroup("Direction Spinning Hardness");
public FloatValueGroup directionSpinningSpeed = new FloatValueGroup("Direction Spinning Speed");
//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
@@ -30,23 +24,9 @@ namespace Reset.Units {
//Call EndAction() to mark the action as finished, either in success or failure.
//EndAction can be called from anywhere.
protected override void OnExecute() {
// Direction from value
// Check that feedDir is not changed
// UpdateVector3Value(feedNewDirection, ref feedDir, ref feedDir);
//
// Vector3ValueGroup.ResolvedValue(feedNewDirection, ref feedDir, ref feedDir);
//
// // If there's a direciton add it to the player for a frame
// if (feedDir != Vector3.zero) {
// agent.AddToCurrentDirection(agent.transform.rotation * feedDir.normalized, newDirectionStrength);
// // Reset the fed direction after it's added so future runs don't have
// feedDir = Vector3.zero;
// }
// Direction from controller input
if (addDirectionFromInput != Vector2.zero){
agent.OverwriteDirectionFromInput(new Vector3(addDirectionFromInput.x, addDirectionFromInput.y), addInputPriorty, addInputStrength);
}
FloatValueGroup.UpdateValue(directionChangingSoftness, agent.data.directionChangingSoftness);
FloatValueGroup.UpdateValue(directionSpinningHardness, agent.data.directionSpinningHardness);
FloatValueGroup.UpdateValue(directionSpinningSpeed, agent.data.directionSpinningSpeed);
EndAction(true);
}

View File

@@ -9,10 +9,8 @@ namespace Reset.Units {
[Category("Reset/Movement")]
public class ChangeGravitySettings : ActionTask<UnitMovementHandler>{
[SerializeField] public FloatValueGroup jumpPower = new FloatValueGroup("Jump Power");
[SerializeField] public FloatValueGroup jumpPowerDecay = new FloatValueGroup("Jump Power Decay");
[SliderField(0f, 1f), SerializeField] public FloatValueGroup airDirectionDecay = new FloatValueGroup("Air Direction Decay");
[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");
@@ -27,23 +25,10 @@ namespace Reset.Units {
//Call EndAction() to mark the action as finished, either in success or failure.
//EndAction can be called from anywhere.
protected override void OnExecute() {
// Deprecated by unified gravity system, including SetNewGravity
// // Jump
// 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, agent.data.jumpPowerDecay);
// Deprecated by SetNewGravity
// 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(airDirectionDecay, agent.data.airDirectionDecay);
FloatValueGroup.UpdateValue(gravityMax, agent.data.gravityMax);
FloatValueGroup.UpdateValue(gravityAcceleration, agent.data.gravityAcceleration);
FloatValueGroup.UpdateValue(gravityScale, agent.data.gravityScale);
}

View File

@@ -22,18 +22,9 @@ namespace Reset.Units {
//Call EndAction() to mark the action as finished, either in success or failure.
//EndAction can be called from anywhere.
protected override void OnExecute() {
FloatValueGroup.UpdateValue(moveSpeed, ref agent.data.moveSpeed.targetValue, ref agent.data.moveSpeed.defaultValue);
ValueGroup.ChangeSmoothingEasing(moveSpeed, ref agent.data.moveSpeed.targetSmoothing,
ref agent.data.moveSpeed.targetEasing, ref agent.data.moveSpeed.defaultSmoothing, ref agent.data.moveSpeed.defaultEasing);
FloatValueGroup.UpdateValue(acceleration, ref agent.data.acceleration.targetValue, ref agent.data.acceleration.defaultValue);
ValueGroup.ChangeSmoothingEasing(acceleration, ref agent.data.acceleration.targetSmoothing,
ref agent.data.acceleration.targetEasing, ref agent.data.acceleration.defaultSmoothing, ref agent.data.acceleration.defaultEasing);
FloatValueGroup.UpdateValue(deacceleration, ref agent.data.deacceleration.targetValue, ref agent.data.deacceleration.defaultValue);
ValueGroup.ChangeSmoothingEasing(deacceleration, ref agent.data.deacceleration.targetSmoothing,
ref agent.data.deacceleration.targetEasing, ref agent.data.deacceleration.defaultSmoothing, ref agent.data.deacceleration.defaultEasing);
FloatValueGroup.UpdateValue(moveSpeed, agent.data.moveSpeed);
FloatValueGroup.UpdateValue(acceleration, agent.data.acceleration);
FloatValueGroup.UpdateValue(deacceleration, agent.data.deacceleration);
EndAction(true);
}

View File

@@ -1,12 +1,18 @@
using System;
using Codice.Client.BaseCommands;
using NodeCanvas.Framework;
using ParadoxNotion.Design;
using Reset.Core;
using UnityEngine;
namespace Reset.Units {
[Category("Reset/Movement")]
public class ChangeRotationSettings : ActionTask<UnitMovementHandler> {
[SerializeField] public EnumValueGroup facingDirection = new EnumValueGroup("Facing Direction", PlayerFacingDirection.TowardsTarget);
[SerializeField] public FloatValueGroup rotationSpeed = new (newLabel: "Rotation Speed");
//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() {
@@ -16,7 +22,10 @@ namespace Reset.Units {
//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() {
protected override void OnExecute(){
EnumValueGroup.UpdateValue(facingDirection, agent.data.facingDirection);
FloatValueGroup.UpdateValue(rotationSpeed, agent.data.rotationSpeed);
EndAction(true);
}