change: more alterations to movement, settingvalues, valuegroup, etc.
This commit is contained in:
@@ -60,7 +60,6 @@ namespace NodeCanvas.Tasks.Actions {
|
||||
BoolValueGroup.UpdateValue(enableXAxis, ref CameraSettingsProcessor.data.axisLookEnabledX.value, ref CameraSettingsProcessor.original.axisLookEnabledX.value);
|
||||
BoolValueGroup.UpdateValue(enableYAxis, ref CameraSettingsProcessor.data.axisLookEnabledY.value, ref CameraSettingsProcessor.original.axisLookEnabledY.value);
|
||||
|
||||
|
||||
EndAction(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -1,22 +1,25 @@
|
||||
using System;
|
||||
using NodeCanvas.Framework;
|
||||
using ParadoxNotion.Serialization.FullSerializer;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
namespace Reset.Core{
|
||||
[Serializable]
|
||||
public abstract class ValueGroup{
|
||||
public interface ISmoothable{
|
||||
public interface ISmoothable{
|
||||
public BBParameter<ValueChangeAction> changeEasing{ get; set; }
|
||||
public BBParameter<ValueChangeAction> changeSmoothing{ get; set; }
|
||||
|
||||
public BBParameter<float> smoothing { get; set; }
|
||||
public BBParameter<float> easing{ get; set; }
|
||||
public BBParameter<float> Smoothing { get; set; }
|
||||
public BBParameter<float> Easing{ get; set; }
|
||||
}
|
||||
|
||||
public static void ChangeSmoothingEasing(ISmoothable valueGroup, ref float targetSmoothing,
|
||||
ref float targetEasing, ref float defaultSmoothing, ref float defaultEasing){
|
||||
switch (valueGroup.changeSmoothing.value) {
|
||||
case ValueChangeAction.NewValue:
|
||||
targetSmoothing = valueGroup.smoothing.value;
|
||||
targetSmoothing = valueGroup.Smoothing.value;
|
||||
break;
|
||||
case ValueChangeAction.ResetValue:
|
||||
targetSmoothing = defaultSmoothing;
|
||||
@@ -25,7 +28,7 @@ namespace Reset.Core{
|
||||
|
||||
switch (valueGroup.changeEasing.value) {
|
||||
case ValueChangeAction.NewValue:
|
||||
targetEasing = valueGroup.easing.value;
|
||||
targetEasing = valueGroup.Easing.value;
|
||||
break;
|
||||
case ValueChangeAction.ResetValue:
|
||||
targetEasing = defaultEasing;
|
||||
@@ -43,7 +46,7 @@ namespace Reset.Core{
|
||||
}
|
||||
|
||||
// Individual bool setting for each ring. Three of these will be used.
|
||||
public struct OrbitalFollowValueGroup : ValueGroup.ISmoothable{
|
||||
public class OrbitalFollowValueGroup : ValueGroup.ISmoothable{
|
||||
public string label;
|
||||
|
||||
public BBParameter<ValueChangeAction> changeHeight;
|
||||
@@ -52,10 +55,33 @@ namespace Reset.Core{
|
||||
public BBParameter<ValueChangeAction> changeRadius;
|
||||
public BBParameter<float> radius;
|
||||
|
||||
public BBParameter<ValueChangeAction> changeEasing{ get; set; }
|
||||
public BBParameter<ValueChangeAction> changeSmoothing{ get; set; }
|
||||
public BBParameter<float> smoothing{ get; set; }
|
||||
public BBParameter<float> easing{ get; set; }
|
||||
// Smoothing
|
||||
[SerializeField] private BBParameter<ValueChangeAction> _changeSmoothing;
|
||||
[SerializeField] public BBParameter<float> _smoothing;
|
||||
|
||||
public BBParameter<ValueChangeAction> changeSmoothing{
|
||||
get => _changeSmoothing;
|
||||
set => _changeSmoothing = value.value;
|
||||
}
|
||||
|
||||
public BBParameter<float> Smoothing{
|
||||
get => _smoothing;
|
||||
set => _smoothing = value.value;
|
||||
}
|
||||
|
||||
// Easing
|
||||
[SerializeField] private BBParameter<ValueChangeAction> _changeEasing;
|
||||
[SerializeField] public BBParameter<float> _easing;
|
||||
|
||||
public BBParameter<ValueChangeAction> changeEasing{
|
||||
get => _changeEasing;
|
||||
set => _changeEasing = value.value;
|
||||
}
|
||||
|
||||
public BBParameter<float> Easing{
|
||||
get => _easing;
|
||||
set => _easing = value.value;
|
||||
}
|
||||
|
||||
public OrbitalFollowValueGroup(string newLabel){
|
||||
label = newLabel;
|
||||
@@ -64,12 +90,14 @@ namespace Reset.Core{
|
||||
height = 0f;
|
||||
changeRadius = ValueChangeAction.NoChange;
|
||||
radius = 0f;
|
||||
|
||||
changeSmoothing = new BBParameter<ValueChangeAction>();
|
||||
Smoothing = new BBParameter<float>().value = 0f;
|
||||
|
||||
changeSmoothing = ValueChangeAction.NoChange;
|
||||
smoothing = .1f;
|
||||
|
||||
changeEasing = ValueChangeAction.NoChange;
|
||||
easing = 1f;
|
||||
changeEasing = new BBParameter<ValueChangeAction>();
|
||||
Easing = new BBParameter<float>().value = 0f;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static void UpdateValue(OrbitalFollowValueGroup valueGroup, ref float targetProperty, ref float defaultProperty){
|
||||
@@ -143,14 +171,46 @@ namespace Reset.Core{
|
||||
}
|
||||
}
|
||||
|
||||
public struct Vector3ValueGroup{ // Done
|
||||
public class Vector3ValueGroup : ValueGroup.ISmoothable{ // Done
|
||||
public string label;
|
||||
|
||||
// Value
|
||||
public BBParameter<Vector3> value;
|
||||
|
||||
public BBParameter<ValueChangeAction> changeX;
|
||||
public BBParameter<ValueChangeAction> changeY;
|
||||
public BBParameter<ValueChangeAction> changeZ;
|
||||
|
||||
|
||||
// Smoothing
|
||||
[SerializeField] private BBParameter<ValueChangeAction> _changeSmoothing;
|
||||
[SerializeField] public BBParameter<float> _smoothing;
|
||||
|
||||
public BBParameter<ValueChangeAction> changeSmoothing{
|
||||
get => _changeSmoothing;
|
||||
set => _changeSmoothing = value.value;
|
||||
}
|
||||
|
||||
public BBParameter<float> Smoothing{
|
||||
get => _smoothing;
|
||||
set => _smoothing = value.value;
|
||||
}
|
||||
|
||||
// Easing
|
||||
[SerializeField] private BBParameter<ValueChangeAction> _changeEasing;
|
||||
[SerializeField] public BBParameter<float> _easing;
|
||||
|
||||
public BBParameter<ValueChangeAction> changeEasing{
|
||||
get => _changeEasing;
|
||||
set => _changeEasing = value.value;
|
||||
}
|
||||
|
||||
public BBParameter<float> Easing{
|
||||
get => _easing;
|
||||
set => _easing = value.value;
|
||||
}
|
||||
|
||||
// Constructor
|
||||
public Vector3ValueGroup(string newLabel){
|
||||
changeX = ValueChangeAction.NoChange;
|
||||
changeY = ValueChangeAction.NoChange;
|
||||
@@ -161,6 +221,12 @@ namespace Reset.Core{
|
||||
};
|
||||
|
||||
label = newLabel;
|
||||
|
||||
changeSmoothing = new BBParameter<ValueChangeAction>();
|
||||
Smoothing = new BBParameter<float>().value = 0f;
|
||||
|
||||
changeEasing = new BBParameter<ValueChangeAction>();
|
||||
Easing = new BBParameter<float>().value = 0f;
|
||||
}
|
||||
|
||||
public static void UpdateValue(Vector3ValueGroup valueGroup, ref Vector3 targetProperty, ref Vector3 defaultProperty){
|
||||
@@ -193,21 +259,47 @@ namespace Reset.Core{
|
||||
}
|
||||
}
|
||||
|
||||
public struct Vector2ValueGroup : ValueGroup.ISmoothable{ // Done
|
||||
[Serializable]
|
||||
public class Vector2ValueGroup : ValueGroup.ISmoothable{ // Done
|
||||
public string label;
|
||||
|
||||
// Value
|
||||
public BBParameter<Vector2> value;
|
||||
|
||||
public BBParameter<ValueChangeAction> changeEasing{ get; set; }
|
||||
public BBParameter<ValueChangeAction> changeSmoothing{ get; set; }
|
||||
public BBParameter<float> smoothing{ get; set; }
|
||||
public BBParameter<float> easing{ get; set; }
|
||||
|
||||
public BBParameter<ValueChangeAction> changeX;
|
||||
public BBParameter<ValueChangeAction> changeY;
|
||||
public BBParameter<ValueChangeAction> changeY;
|
||||
|
||||
// Smoothing
|
||||
[SerializeField] private BBParameter<ValueChangeAction> _changeSmoothing;
|
||||
[SerializeField] public BBParameter<float> _smoothing;
|
||||
|
||||
public BBParameter<ValueChangeAction> changeSmoothing{
|
||||
get => _changeSmoothing;
|
||||
set => _changeSmoothing = value.value;
|
||||
}
|
||||
|
||||
public BBParameter<float> Smoothing{
|
||||
get => _smoothing;
|
||||
set => _smoothing = value.value;
|
||||
}
|
||||
|
||||
// Easing
|
||||
[SerializeField] private BBParameter<ValueChangeAction> _changeEasing;
|
||||
[SerializeField] public BBParameter<float> _easing;
|
||||
|
||||
public BBParameter<ValueChangeAction> changeEasing{
|
||||
get => _changeEasing;
|
||||
set => _changeEasing = value.value;
|
||||
}
|
||||
|
||||
public BBParameter<float> Easing{
|
||||
get => _easing;
|
||||
set => _easing = value.value;
|
||||
}
|
||||
|
||||
// Constructor
|
||||
public Vector2ValueGroup(string newLabel){
|
||||
changeX = ValueChangeAction.NoChange;
|
||||
changeY = ValueChangeAction.NoChange;
|
||||
changeX = new BBParameter<ValueChangeAction>().value = ValueChangeAction.NoChange;
|
||||
changeY = new BBParameter<ValueChangeAction>().value = ValueChangeAction.NoChange;
|
||||
|
||||
value = new BBParameter<Vector2>{
|
||||
value = Vector2.zero
|
||||
@@ -215,10 +307,11 @@ namespace Reset.Core{
|
||||
|
||||
label = newLabel;
|
||||
|
||||
changeEasing = ValueChangeAction.NoChange;
|
||||
changeSmoothing = ValueChangeAction.NoChange;
|
||||
smoothing = 0;
|
||||
easing = 0;
|
||||
changeSmoothing = new BBParameter<ValueChangeAction>();
|
||||
Smoothing = new BBParameter<float>().value = 0f;
|
||||
|
||||
changeEasing = new BBParameter<ValueChangeAction>();
|
||||
Easing = new BBParameter<float>().value = 0f;
|
||||
}
|
||||
|
||||
public static void UpdateValue(Vector2ValueGroup valueGroup, ref Vector2 targetProperty, ref Vector2 defaultProperty){
|
||||
@@ -229,7 +322,6 @@ namespace Reset.Core{
|
||||
case ValueChangeAction.ResetValue:
|
||||
targetProperty.x = defaultProperty.x;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
switch (valueGroup.changeY.value) {
|
||||
@@ -241,32 +333,55 @@ namespace Reset.Core{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class FloatValueGroup : ValueGroup.ISmoothable{ // Done
|
||||
[Serializable]
|
||||
public class FloatValueGroup : ValueGroup.ISmoothable{ // Done, fixed
|
||||
public string label;
|
||||
|
||||
// Value
|
||||
public BBParameter<ValueChangeAction> changeValue;
|
||||
public BBParameter<float> value;
|
||||
|
||||
public BBParameter<ValueChangeAction> changeEasing{ get; set; }
|
||||
public BBParameter<ValueChangeAction> changeSmoothing{ get; set; }
|
||||
public BBParameter<float> smoothing { get; set; }
|
||||
public BBParameter<float> easing{ get; set; }
|
||||
|
||||
// Smoothing
|
||||
[SerializeField] private BBParameter<ValueChangeAction> _changeSmoothing;
|
||||
[SerializeField] public BBParameter<float> _smoothing;
|
||||
|
||||
public BBParameter<ValueChangeAction> changeSmoothing{
|
||||
get => _changeSmoothing;
|
||||
set => _changeSmoothing = value.value;
|
||||
}
|
||||
|
||||
public BBParameter<float> Smoothing{
|
||||
get => _smoothing;
|
||||
set => _smoothing = value.value;
|
||||
}
|
||||
|
||||
// Easing
|
||||
[SerializeField] private BBParameter<ValueChangeAction> _changeEasing;
|
||||
[SerializeField] public BBParameter<float> _easing;
|
||||
|
||||
public BBParameter<ValueChangeAction> changeEasing{
|
||||
get => _changeEasing;
|
||||
set => _changeEasing = value.value;
|
||||
}
|
||||
|
||||
public BBParameter<float> Easing{
|
||||
get => _easing;
|
||||
set => _easing = value.value;
|
||||
}
|
||||
|
||||
// Constructor
|
||||
public FloatValueGroup(string newLabel){
|
||||
label = newLabel;
|
||||
value = new BBParameter<float>().value = 0f;
|
||||
changeValue = ValueChangeAction.NoChange;
|
||||
changeValue = new BBParameter<ValueChangeAction>();
|
||||
|
||||
changeSmoothing = ValueChangeAction.NoChange;
|
||||
smoothing = 0f;
|
||||
changeSmoothing = new BBParameter<ValueChangeAction>();
|
||||
Smoothing = new BBParameter<float>().value = 0f;
|
||||
|
||||
changeEasing = ValueChangeAction.NoChange;
|
||||
easing = 0f;
|
||||
changeEasing = new BBParameter<ValueChangeAction>();
|
||||
Easing = new BBParameter<float>().value = 0f;
|
||||
}
|
||||
|
||||
public static void UpdateValue(FloatValueGroup valueGroup, ref float targetProperty, ref float defaultProperty){
|
||||
@@ -277,6 +392,9 @@ namespace Reset.Core{
|
||||
case ValueChangeAction.ResetValue:
|
||||
targetProperty = defaultProperty;
|
||||
break;
|
||||
case ValueChangeAction.RelativeValue:
|
||||
targetProperty += valueGroup.value.value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,10 @@ using UnityEngine;
|
||||
// Create the value/disabled information field
|
||||
if (_instance.changeValue.value == ValueChangeAction.NewValue){
|
||||
_instance.value = EditorGUILayout.Toggle(_instance.value.value, floatOptions);
|
||||
} else if (_instance.changeValue.value == ValueChangeAction.RelativeValue){
|
||||
EditorGUI.BeginDisabledGroup(true);
|
||||
EditorGUILayout.TextField("Not Available", floatOptions);
|
||||
EditorGUI.EndDisabledGroup();
|
||||
} else {
|
||||
EditorGUI.BeginDisabledGroup(true);
|
||||
EditorGUILayout.TextField(_instance.changeValue.value == ValueChangeAction.NoChange ? "Unchanged" : "Reset", floatOptions);
|
||||
@@ -176,8 +180,7 @@ using UnityEngine;
|
||||
BBParameterEditor.ParameterField("", _instance.changeValue);
|
||||
|
||||
// Create the value/disabled information field
|
||||
if (_instance.changeValue.value == ValueChangeAction.NewValue){
|
||||
// _instance.value = EditorGUILayout.FloatField(_instance.value, floatOptions);
|
||||
if (_instance.changeValue.value == ValueChangeAction.NewValue || _instance.changeValue.value == ValueChangeAction.RelativeValue){
|
||||
BBParameterEditor.ParameterField("", _instance.value);
|
||||
} else {
|
||||
EditorGUI.BeginDisabledGroup(true);
|
||||
@@ -187,65 +190,9 @@ using UnityEngine;
|
||||
|
||||
// Close this line up with the variables
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
// Start the smoothing and easing section
|
||||
GUILayout.BeginHorizontal();
|
||||
|
||||
GUIStyle smallText= new GUIStyle{
|
||||
fontSize = 10,
|
||||
padding = new RectOffset(8, 0, 0,0),
|
||||
normal ={
|
||||
textColor = Color.gray
|
||||
}
|
||||
};
|
||||
|
||||
// Start the left side for easing
|
||||
GUILayout.BeginVertical();
|
||||
|
||||
// Draw the label
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.Label("Easing", smallText);
|
||||
GUILayout.EndHorizontal();
|
||||
ValueGroupEditorUtilities.DrawEasingAndSmoothingSection(_instance);
|
||||
|
||||
// Easing
|
||||
_instance.changeEasing.value = (ValueChangeAction)EditorGUILayout.EnumPopup("", instance.changeEasing.value);
|
||||
if (_instance.changeEasing.value == ValueChangeAction.NewValue){
|
||||
// _instance.value = EditorGUILayout.FloatField(_instance.value, floatOptions);
|
||||
BBParameterEditor.ParameterField("", _instance.easing);
|
||||
} else {
|
||||
EditorGUI.BeginDisabledGroup(true);
|
||||
EditorGUILayout.TextField(_instance.changeEasing.value == ValueChangeAction.NoChange ? "Unchanged" : "Reset", floatOptions);
|
||||
EditorGUI.EndDisabledGroup();
|
||||
}
|
||||
|
||||
// Close easing
|
||||
GUILayout.EndVertical();
|
||||
|
||||
// Start the right for smoothing
|
||||
GUILayout.BeginVertical();
|
||||
|
||||
// Draw the label
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.Label("Smoothing", smallText);
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
// Easing
|
||||
_instance.changeSmoothing.value = (ValueChangeAction)EditorGUILayout.EnumPopup("", instance.changeSmoothing.value);
|
||||
if (_instance.changeSmoothing.value == ValueChangeAction.NewValue){
|
||||
// _instance.value = EditorGUILayout.FloatField(_instance.value, floatOptions);
|
||||
BBParameterEditor.ParameterField("", _instance.smoothing);
|
||||
} else {
|
||||
EditorGUI.BeginDisabledGroup(true);
|
||||
EditorGUILayout.TextField(_instance.changeSmoothing.value == ValueChangeAction.NoChange ? "Unchanged" : "Reset", floatOptions);
|
||||
EditorGUI.EndDisabledGroup();
|
||||
}
|
||||
|
||||
// Close easing
|
||||
GUILayout.EndVertical();
|
||||
|
||||
GUILayout.Space(8);
|
||||
|
||||
GUILayout.EndHorizontal();
|
||||
// Reset to default so the rest of things don't get messed up
|
||||
EditorGUIUtility.labelWidth = 0;
|
||||
return _instance;
|
||||
@@ -323,6 +270,9 @@ using UnityEngine;
|
||||
|
||||
// Close this line up
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
ValueGroupEditorUtilities.DrawEasingAndSmoothingSection(_instance);
|
||||
|
||||
GUILayout.EndVertical();
|
||||
|
||||
// Reset to default so the rest of things don't get messed up
|
||||
@@ -385,6 +335,9 @@ using UnityEngine;
|
||||
|
||||
// Close this line up
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
ValueGroupEditorUtilities.DrawEasingAndSmoothingSection(_instance);
|
||||
|
||||
GUILayout.EndVertical();
|
||||
|
||||
// Reset to default so the rest of things don't get messed up
|
||||
@@ -445,10 +398,84 @@ using UnityEngine;
|
||||
|
||||
// Close this line up
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
ValueGroupEditorUtilities.DrawEasingAndSmoothingSection(_instance);
|
||||
|
||||
// Reset to default so the rest of things don't get messed up
|
||||
EditorGUIUtility.labelWidth = 0;
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
|
||||
public static class ValueGroupEditorUtilities{
|
||||
public static void DrawEasingAndSmoothingSection(ValueGroup.ISmoothable _instance){
|
||||
// Start the smoothing and easing section
|
||||
GUILayout.BeginHorizontal();
|
||||
|
||||
GUIStyle smallText= new GUIStyle{
|
||||
fontSize = 10,
|
||||
padding = new RectOffset(8, 0, 0,0),
|
||||
normal ={
|
||||
textColor = Color.gray
|
||||
}
|
||||
};
|
||||
|
||||
// Start the left side for easing
|
||||
GUILayout.BeginVertical();
|
||||
|
||||
// Draw the label
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.Label("Easing", smallText);
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
// Easing
|
||||
// _instance.changeEasing.value = (ValueChangeAction)EditorGUILayout.EnumPopup("", instance.changeEasing.value);
|
||||
BBParameterEditor.ParameterField("", _instance.changeEasing);
|
||||
|
||||
if (_instance.changeEasing.value == ValueChangeAction.NewValue){
|
||||
// _instance.value = EditorGUILayout.FloatField(_instance.value, floatOptions);
|
||||
BBParameterEditor.ParameterField("", _instance.Easing);
|
||||
} else {
|
||||
EditorGUI.BeginDisabledGroup(true);
|
||||
EditorGUILayout.TextField(_instance.changeEasing.value == ValueChangeAction.NoChange ? "Unchanged" : "Reset", floatOptions);
|
||||
EditorGUI.EndDisabledGroup();
|
||||
}
|
||||
|
||||
// Close easing
|
||||
GUILayout.EndVertical();
|
||||
|
||||
// Start the right for smoothing
|
||||
GUILayout.BeginVertical();
|
||||
|
||||
// Draw the label
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.Label("Smoothing", smallText);
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
// Smoothing
|
||||
BBParameterEditor.ParameterField("", _instance.changeSmoothing);
|
||||
|
||||
if (_instance.changeSmoothing.value == ValueChangeAction.NewValue){
|
||||
// _instance.value = EditorGUILayout.FloatField(_instance.value, floatOptions);
|
||||
BBParameterEditor.ParameterField("", _instance.Smoothing);
|
||||
} else {
|
||||
EditorGUI.BeginDisabledGroup(true);
|
||||
EditorGUILayout.TextField(_instance.changeSmoothing.value == ValueChangeAction.NoChange ? "Unchanged" : "Reset", floatOptions);
|
||||
EditorGUI.EndDisabledGroup();
|
||||
}
|
||||
|
||||
// Close easing
|
||||
GUILayout.EndVertical();
|
||||
|
||||
GUILayout.Space(8);
|
||||
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
static GUILayoutOption[] floatOptions = new GUILayoutOption[] {
|
||||
GUILayout.Width(300.0f),
|
||||
GUILayout.MinWidth(20.0f),
|
||||
GUILayout.ExpandWidth(true),
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user