312 lines
8.4 KiB
C#
312 lines
8.4 KiB
C#
using System;
|
|
using NodeCanvas.Framework;
|
|
using UnityEngine;
|
|
|
|
namespace Reset.Core{
|
|
public abstract class ValueGroup{
|
|
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 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;
|
|
break;
|
|
case ValueChangeAction.ResetValue:
|
|
targetSmoothing = defaultSmoothing;
|
|
break;
|
|
}
|
|
|
|
switch (valueGroup.changeEasing.value) {
|
|
case ValueChangeAction.NewValue:
|
|
targetEasing = valueGroup.easing.value;
|
|
break;
|
|
case ValueChangeAction.ResetValue:
|
|
targetEasing = defaultEasing;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
// Enum options for individual settings
|
|
public enum ValueChangeAction{
|
|
NoChange,
|
|
NewValue,
|
|
ResetValue,
|
|
RelativeValue, // Placeholder for using as altering existing value
|
|
}
|
|
|
|
// Individual bool setting for each ring. Three of these will be used.
|
|
public struct OrbitalFollowValueGroup : ValueGroup.ISmoothable{
|
|
public string label;
|
|
|
|
public BBParameter<ValueChangeAction> changeHeight;
|
|
public BBParameter<float> height;
|
|
|
|
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; }
|
|
|
|
public OrbitalFollowValueGroup(string newLabel){
|
|
label = newLabel;
|
|
|
|
changeHeight = ValueChangeAction.NoChange;
|
|
height = 0f;
|
|
changeRadius = ValueChangeAction.NoChange;
|
|
radius = 0f;
|
|
|
|
changeSmoothing = ValueChangeAction.NoChange;
|
|
smoothing = .1f;
|
|
|
|
changeEasing = ValueChangeAction.NoChange;
|
|
easing = 1f;
|
|
}
|
|
|
|
public static void UpdateValue(OrbitalFollowValueGroup valueGroup, ref float targetProperty, ref float defaultProperty){
|
|
switch (valueGroup.changeHeight.value) {
|
|
case ValueChangeAction.NewValue:
|
|
targetProperty = valueGroup.height.value;
|
|
break;
|
|
case ValueChangeAction.ResetValue:
|
|
targetProperty = defaultProperty;
|
|
break;
|
|
}
|
|
|
|
switch (valueGroup.changeRadius.value) {
|
|
case ValueChangeAction.NewValue:
|
|
targetProperty = valueGroup.radius.value;
|
|
break;
|
|
case ValueChangeAction.ResetValue:
|
|
targetProperty = defaultProperty;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
public struct CurveValueGroup{ // Done
|
|
public string label;
|
|
public BBParameter<AnimationCurve> value;
|
|
|
|
public BBParameter<ValueChangeAction> changeValue;
|
|
|
|
public CurveValueGroup(string newLabel){
|
|
changeValue = ValueChangeAction.NoChange;
|
|
|
|
value = new AnimationCurve();
|
|
label = newLabel;
|
|
}
|
|
|
|
public static void UpdateValue(CurveValueGroup valueGroup, ref AnimationCurve targetProperty, ref AnimationCurve defaultProperty){
|
|
switch (valueGroup.changeValue.value) {
|
|
case ValueChangeAction.NewValue:
|
|
targetProperty = valueGroup.value.value;
|
|
break;
|
|
case ValueChangeAction.ResetValue:
|
|
targetProperty = defaultProperty;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
public struct EnumValueGroup{ // Done
|
|
public string label;
|
|
public BBParameter<Enum> value;
|
|
|
|
public BBParameter<ValueChangeAction> changeValue;
|
|
|
|
public EnumValueGroup(string newLabel, Enum enumType){
|
|
changeValue = ValueChangeAction.NoChange;
|
|
|
|
value = enumType;
|
|
label = newLabel;
|
|
}
|
|
|
|
public static void UpdateValue(EnumValueGroup valueGroup, ref Enum targetProperty, ref Enum defaultProperty){
|
|
switch (valueGroup.changeValue.value) {
|
|
case ValueChangeAction.NewValue:
|
|
targetProperty = valueGroup.value.value;
|
|
break;
|
|
case ValueChangeAction.ResetValue:
|
|
targetProperty = defaultProperty;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
public struct Vector3ValueGroup{ // Done
|
|
public string label;
|
|
public BBParameter<Vector3> value;
|
|
|
|
public BBParameter<ValueChangeAction> changeX;
|
|
public BBParameter<ValueChangeAction> changeY;
|
|
public BBParameter<ValueChangeAction> changeZ;
|
|
|
|
public Vector3ValueGroup(string newLabel){
|
|
changeX = ValueChangeAction.NoChange;
|
|
changeY = ValueChangeAction.NoChange;
|
|
changeZ = ValueChangeAction.NoChange;
|
|
|
|
value = new BBParameter<Vector3>{
|
|
value = Vector3.zero
|
|
};
|
|
|
|
label = newLabel;
|
|
}
|
|
|
|
public static void UpdateValue(Vector3ValueGroup valueGroup, ref Vector3 targetProperty, ref Vector3 defaultProperty){
|
|
switch (valueGroup.changeX.value) {
|
|
case ValueChangeAction.NewValue:
|
|
targetProperty.x = valueGroup.value.value.x;
|
|
break;
|
|
case ValueChangeAction.ResetValue:
|
|
targetProperty.x = defaultProperty.x;
|
|
break;
|
|
}
|
|
|
|
switch (valueGroup.changeY.value) {
|
|
case ValueChangeAction.NewValue:
|
|
targetProperty.y = valueGroup.value.value.y;
|
|
break;
|
|
case ValueChangeAction.ResetValue:
|
|
targetProperty.y = defaultProperty.y;
|
|
break;
|
|
}
|
|
|
|
switch (valueGroup.changeZ.value) {
|
|
case ValueChangeAction.NewValue:
|
|
targetProperty.z = valueGroup.value.value.z;
|
|
break;
|
|
case ValueChangeAction.ResetValue:
|
|
targetProperty.z = defaultProperty.z;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
public struct Vector2ValueGroup : ValueGroup.ISmoothable{ // Done
|
|
public string label;
|
|
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 Vector2ValueGroup(string newLabel){
|
|
changeX = ValueChangeAction.NoChange;
|
|
changeY = ValueChangeAction.NoChange;
|
|
|
|
value = new BBParameter<Vector2>{
|
|
value = Vector2.zero
|
|
};
|
|
|
|
label = newLabel;
|
|
|
|
changeEasing = ValueChangeAction.NoChange;
|
|
changeSmoothing = ValueChangeAction.NoChange;
|
|
smoothing = 0;
|
|
easing = 0;
|
|
}
|
|
|
|
public static void UpdateValue(Vector2ValueGroup valueGroup, ref Vector2 targetProperty, ref Vector2 defaultProperty){
|
|
switch (valueGroup.changeX.value) {
|
|
case ValueChangeAction.NewValue:
|
|
targetProperty.x = valueGroup.value.value.x;
|
|
break;
|
|
case ValueChangeAction.ResetValue:
|
|
targetProperty.x = defaultProperty.x;
|
|
break;
|
|
|
|
}
|
|
|
|
switch (valueGroup.changeY.value) {
|
|
case ValueChangeAction.NewValue:
|
|
targetProperty.y = valueGroup.value.value.y;
|
|
break;
|
|
case ValueChangeAction.ResetValue:
|
|
targetProperty.y = defaultProperty.y;
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
public class FloatValueGroup : ValueGroup.ISmoothable{ // Done
|
|
public string label;
|
|
|
|
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; }
|
|
|
|
public FloatValueGroup(string newLabel){
|
|
label = newLabel;
|
|
value = new BBParameter<float>().value = 0f;
|
|
changeValue = ValueChangeAction.NoChange;
|
|
|
|
changeSmoothing = ValueChangeAction.NoChange;
|
|
smoothing = 0f;
|
|
|
|
changeEasing = ValueChangeAction.NoChange;
|
|
easing = 0f;
|
|
}
|
|
|
|
public static void UpdateValue(FloatValueGroup valueGroup, ref float targetProperty, ref float defaultProperty){
|
|
switch (valueGroup.changeValue.value) {
|
|
case ValueChangeAction.NewValue:
|
|
targetProperty = valueGroup.value.value;
|
|
break;
|
|
case ValueChangeAction.ResetValue:
|
|
targetProperty = defaultProperty;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
public struct BoolValueGroup{
|
|
public string label;
|
|
public BBParameter<bool> value;
|
|
|
|
public BBParameter<ValueChangeAction> changeValue;
|
|
|
|
public BoolValueGroup(string newLabel){
|
|
label = newLabel;
|
|
value = true;
|
|
changeValue = ValueChangeAction.NoChange;
|
|
}
|
|
|
|
public static void UpdateValue(BoolValueGroup valueGroup, ref bool targetProperty, ref bool defaultProperty){
|
|
switch (valueGroup.changeValue.value) {
|
|
case ValueChangeAction.NewValue:
|
|
targetProperty = valueGroup.value.value;
|
|
break;
|
|
case ValueChangeAction.ResetValue:
|
|
targetProperty = defaultProperty;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|