changed: changing some air movement values can now be smoothed (including values that are used to smoothing out inputs)

This commit is contained in:
Chris
2025-08-21 17:29:22 -04:00
parent 93634a9586
commit a289c78b5d
7 changed files with 337 additions and 145 deletions

View File

@@ -147,7 +147,7 @@ namespace NodeCanvas.Tasks.Actions {
public void UpdateFloatValue(FloatValueGroup valueGroup, ref CameraSettingSingleValue<float> targetProperty){
switch (valueGroup.changeValue) {
case ValueChangeAction.NewValue:
targetProperty.targetValue = valueGroup.value;
targetProperty.targetValue = valueGroup.value.value;
break;
case ValueChangeAction.ResetValue:
targetProperty.targetValue = targetProperty.originalValue;

View File

@@ -40,6 +40,7 @@ namespace Reset.Core {
public FloatValueGroup gravityMax = new (newLabel: "Gravity Max");
public FloatValueGroup gravityAcceleration = new (newLabel: "Gravity Acceleration Speed");
public FloatValueGroup gravityScale = new (newLabel: "Gravity Scale");
public FloatValueGroup settingsChangeSmoothing = new(newLabel: "Settings Change Smoothing");
// Rotation
[ParadoxNotion.Design.Header("Rotation")]
@@ -97,6 +98,7 @@ namespace Reset.Core {
UpdateFloatValue(gravityMax, ref agent.data.gravityMax, ref agent.defaultData.gravityMax);
UpdateFloatValue(gravityAcceleration, ref agent.data.gravityAcceleration, ref agent.defaultData.gravityAcceleration);
UpdateFloatValue(gravityScale, ref agent.data.gravityScale, ref agent.defaultData.gravityScale);
UpdateFloatValue(settingsChangeSmoothing, ref agent.data.settingsChangeSmoothing, ref agent.data.settingsChangeSmoothing);
// Rotation
UpdateEnumValue(rotateFacing, ref agent.data.rotateFacing, ref agent.defaultData.rotateFacing);
@@ -222,7 +224,7 @@ namespace Reset.Core {
public void UpdateFloatValue(FloatValueGroup valueGroup, ref float targetProperty, ref float defaultProperty){
switch (valueGroup.changeValue) {
case ValueChangeAction.NewValue:
targetProperty = valueGroup.value;
targetProperty = valueGroup.value.value;
break;
case ValueChangeAction.ResetValue:
targetProperty = defaultProperty;

View File

@@ -1,4 +1,6 @@
using System;
using NodeCanvas.Editor;
using NodeCanvas.Framework;
using ParadoxNotion.Design;
using UnityEditor;
using UnityEngine;
@@ -97,13 +99,14 @@ namespace Reset.Core{
public struct FloatValueGroup{
public string label;
public float value;
// public float value;
public BBParameter<float> value;
public ValueChangeAction changeValue;
public FloatValueGroup(string newLabel){
label = newLabel;
value = 0f;
value = new BBParameter<float>().value = 0f;
changeValue = ValueChangeAction.NoChange;
}
}
@@ -123,7 +126,7 @@ namespace Reset.Core{
#if UNITY_EDITOR
public class BoolValueGroupDrawer : ObjectDrawer<BoolValueGroup> {
public override BoolValueGroup OnGUI(GUIContent content, BoolValueGroup _instance){
public override BoolValueGroup OnGUI(GUIContent _content, BoolValueGroup _instance){
// Remove label for floats
EditorGUIUtility.labelWidth = 50;
@@ -274,9 +277,11 @@ namespace Reset.Core{
// Create the x settings enum
_instance.changeValue = (ValueChangeAction)EditorGUILayout.EnumPopup("", instance.changeValue);
// Create the value/disabled information field
if (_instance.changeValue == ValueChangeAction.NewValue){
_instance.value = EditorGUILayout.FloatField(_instance.value, floatOptions);
// _instance.value = EditorGUILayout.FloatField(_instance.value, floatOptions);
BBParameterEditor.ParameterField("", _instance.value);
} else {
EditorGUI.BeginDisabledGroup(true);
EditorGUILayout.TextField(_instance.changeValue == ValueChangeAction.NoChange ? "Unchanged" : "Reset", floatOptions);