change: all movement separated into invidividual tasks, a lot of shuffling value groups and related stuff around
This commit is contained in:
@@ -42,118 +42,29 @@ namespace NodeCanvas.Tasks.Actions {
|
||||
//Call EndAction() to mark the action as finished, either in success or failure.
|
||||
//EndAction can be called from anywhere.
|
||||
protected override void OnExecute(){
|
||||
UpdateOrbitFollowValue(orbitFollowTop, ref CameraSettingsProcessor.values.orbitFollowTopHeight, ref CameraSettingsProcessor.values.orbitFollowTopRadius);
|
||||
UpdateOrbitFollowValue(orbitFollowCenter, ref CameraSettingsProcessor.values.orbitFollowCenterHeight, ref CameraSettingsProcessor.values.orbitFollowCenterRadius);
|
||||
UpdateOrbitFollowValue(orbitFollowBottom, ref CameraSettingsProcessor.values.orbitFollowBottomHeight, ref CameraSettingsProcessor.values.orbitFollowBottomRadius);
|
||||
OrbitalFollowValueGroup.UpdateValue(orbitFollowTop, ref CameraSettingsProcessor.data.orbitFollowTopHeight.value, ref CameraSettingsProcessor.original.orbitFollowTopRadius.value);
|
||||
OrbitalFollowValueGroup.UpdateValue(orbitFollowCenter, ref CameraSettingsProcessor.data.orbitFollowCenterHeight.value, ref CameraSettingsProcessor.original.orbitFollowCenterRadius.value);
|
||||
OrbitalFollowValueGroup.UpdateValue(orbitFollowBottom, ref CameraSettingsProcessor.data.orbitFollowBottomHeight.value, ref CameraSettingsProcessor.original.orbitFollowBottomRadius.value);
|
||||
|
||||
UpdateVector3Value(cameraOffset, ref CameraSettingsProcessor.values.cameraOffsetOffset);
|
||||
Vector3ValueGroup.UpdateValue(cameraOffset, ref CameraSettingsProcessor.data.cameraOffsetOffset.value, ref CameraSettingsProcessor.original.cameraOffsetOffset.value);
|
||||
|
||||
UpdateVector3Value(orbitPositionDamping, ref CameraSettingsProcessor.values.orbitPositionDamping);
|
||||
UpdateVector3Value(orbitTargetOffset, ref CameraSettingsProcessor.values.orbitTargetOffset);
|
||||
Vector3ValueGroup.UpdateValue(orbitPositionDamping, ref CameraSettingsProcessor.data.orbitPositionDamping.value, ref CameraSettingsProcessor.original.cameraOffsetOffset.value);
|
||||
Vector3ValueGroup.UpdateValue(orbitTargetOffset, ref CameraSettingsProcessor.data.orbitTargetOffset.value, ref CameraSettingsProcessor.original.cameraOffsetOffset.value);
|
||||
|
||||
UpdateVector2Value(screenPosition, ref CameraSettingsProcessor.values.rotationComposerScreenPos);
|
||||
UpdateFloatValue(fieldOfView, ref CameraSettingsProcessor.values.mainFieldOfView);
|
||||
Vector2ValueGroup.UpdateValue(screenPosition, ref CameraSettingsProcessor.data.rotationComposerScreenPos.value, ref CameraSettingsProcessor.original.rotationComposerScreenPos.value);
|
||||
FloatValueGroup.UpdateValue(fieldOfView, ref CameraSettingsProcessor.data.mainFieldOfView.value, ref CameraSettingsProcessor.original.mainFieldOfView.value);
|
||||
|
||||
UpdateFloatValue(axisLookXGain, ref CameraSettingsProcessor.values.axisLookGainX);
|
||||
UpdateFloatValue(axisLookYGain, ref CameraSettingsProcessor.values.axisLookGainY);
|
||||
FloatValueGroup.UpdateValue(axisLookXGain, ref CameraSettingsProcessor.data.axisLookGainX.value, ref CameraSettingsProcessor.original.axisLookGainX.value);
|
||||
FloatValueGroup.UpdateValue(axisLookYGain, ref CameraSettingsProcessor.data.axisLookGainY.value, ref CameraSettingsProcessor.original.axisLookGainY.value);
|
||||
|
||||
UpdateBoolValue(enableXAxis, ref CameraSettingsProcessor.values.axisLookEnabledX);
|
||||
UpdateBoolValue(enableYAxis, ref CameraSettingsProcessor.values.axisLookEnabledY);
|
||||
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);
|
||||
}
|
||||
|
||||
public void UpdateVector3Value(Vector3ValueGroup valueGroup, ref CameraSettingSingleValue<Vector3> targetProperty){
|
||||
switch (valueGroup.changeX) {
|
||||
case ValueChangeAction.NewValue:
|
||||
targetProperty.targetValue.x = valueGroup.newValue.x;
|
||||
break;
|
||||
case ValueChangeAction.ResetValue:
|
||||
targetProperty.targetValue.x = targetProperty.originalValue.x;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (valueGroup.changeY) {
|
||||
case ValueChangeAction.NewValue:
|
||||
targetProperty.targetValue.y = valueGroup.newValue.y;
|
||||
break;
|
||||
case ValueChangeAction.ResetValue:
|
||||
targetProperty.targetValue.y = targetProperty.originalValue.y;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (valueGroup.changeZ) {
|
||||
case ValueChangeAction.NewValue:
|
||||
targetProperty.targetValue.z = valueGroup.newValue.z;
|
||||
break;
|
||||
case ValueChangeAction.ResetValue:
|
||||
targetProperty.targetValue.z = targetProperty.originalValue.z;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateVector2Value(Vector2ValueGroup valueGroup, ref CameraSettingSingleValue<Vector2> targetProperty){
|
||||
switch (valueGroup.changeX) {
|
||||
case ValueChangeAction.NewValue:
|
||||
targetProperty.targetValue.x = valueGroup.newValue.x;
|
||||
break;
|
||||
case ValueChangeAction.ResetValue:
|
||||
targetProperty.targetValue.x = targetProperty.originalValue.x;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (valueGroup.changeY) {
|
||||
case ValueChangeAction.NewValue:
|
||||
targetProperty.targetValue.y = valueGroup.newValue.y;
|
||||
break;
|
||||
case ValueChangeAction.ResetValue:
|
||||
targetProperty.targetValue.y = targetProperty.originalValue.y;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateOrbitFollowValue(OrbitalFollowValueGroup valueGroup, ref CameraSettingSingleValue<float> targetHeight, ref CameraSettingSingleValue<float> targetRadius){
|
||||
switch (valueGroup.changeHeight) {
|
||||
case ValueChangeAction.NewValue:
|
||||
targetHeight.targetValue = valueGroup.height;
|
||||
break;
|
||||
case ValueChangeAction.ResetValue:
|
||||
targetHeight.targetValue = targetHeight.originalValue;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (valueGroup.changeRadius) {
|
||||
case ValueChangeAction.NewValue:
|
||||
targetRadius.targetValue = valueGroup.radius;
|
||||
break;
|
||||
case ValueChangeAction.ResetValue:
|
||||
targetRadius.targetValue = targetRadius.originalValue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateBoolValue(BoolValueGroup valueGroup, ref CameraSettingSingleValue<bool> targetProperty){
|
||||
switch (valueGroup.changeValue) {
|
||||
case ValueChangeAction.NewValue:
|
||||
targetProperty.targetValue = valueGroup.value;
|
||||
break;
|
||||
case ValueChangeAction.ResetValue:
|
||||
targetProperty.targetValue = targetProperty.originalValue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateFloatValue(FloatValueGroup valueGroup, ref CameraSettingSingleValue<float> targetProperty){
|
||||
switch (valueGroup.changeValue) {
|
||||
case ValueChangeAction.NewValue:
|
||||
targetProperty.targetValue = valueGroup.value.value;
|
||||
break;
|
||||
case ValueChangeAction.ResetValue:
|
||||
targetProperty.targetValue = targetProperty.originalValue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//Called once per frame while the action is active.
|
||||
protected override void OnUpdate() {
|
||||
|
||||
@@ -2,13 +2,15 @@ using System;
|
||||
using NodeCanvas.Framework;
|
||||
using ParadoxNotion.Design;
|
||||
using Reset.Units;
|
||||
using Sirenix.OdinInspector.Editor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Reset.Core {
|
||||
[Category("Reset")]
|
||||
[Description("Commits movement unit changes to the handler.")]
|
||||
public class ChangeMovementSettings : ActionTask<UnitMovementHandler> {
|
||||
// Move Speed
|
||||
|
||||
|
||||
[ParadoxNotion.Design.Header("Speed")]
|
||||
public FloatValueGroup moveSpeed = new (newLabel: "Move Speed");
|
||||
public FloatValueGroup moveSpeedSoothing = new (newLabel: "Move Speed Smoothing");
|
||||
@@ -19,15 +21,7 @@ namespace Reset.Core {
|
||||
public FloatValueGroup deaccelerationSmoothing = new (newLabel: "Deacceleration Smoothing");
|
||||
// public CurveValueGroup deaccelerationCurve = new (newLabel: "Deacceleration Curve"); // Currently unused, may return
|
||||
|
||||
// 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;
|
||||
|
||||
|
||||
// Jumping
|
||||
[ParadoxNotion.Design.Header("Jumping")]
|
||||
@@ -63,48 +57,41 @@ namespace Reset.Core {
|
||||
//Call EndAction() to mark the action as finished, either in success or failure.
|
||||
//EndAction can be called from anywhere.
|
||||
protected override void OnExecute() {
|
||||
// Direction
|
||||
UpdateFloatValue(airDirectionDecay, ref agent.data.airDirectionDecay, ref agent.data.airDirectionDecay);
|
||||
UpdateFloatValue(accelerationSmoothing, ref agent.data.accelerationSmoothing, ref agent.defaultData.accelerationSmoothing);
|
||||
UpdateFloatValue(deaccelerationSmoothing, ref agent.data.deaccelerationSmoothing, ref agent.defaultData.deaccelerationSmoothing);
|
||||
// UpdateCurveProperty(deaccelerationCurve, ref agent.data.deaccelerationCurve, ref agent.defaultData.deaccelerationCurve); // Currently unused, may return
|
||||
|
||||
// Direction from value
|
||||
// Check that feedDir is not changed
|
||||
UpdateVector3Value(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);
|
||||
}
|
||||
|
||||
// Move Speed
|
||||
UpdateFloatValue(moveSpeed, ref agent.data.moveSpeed, ref agent.defaultData.moveSpeed);
|
||||
UpdateFloatValue(moveSpeedSoothing, ref agent.data.moveSpeedSoothing, ref agent.defaultData.moveSpeedSoothing);
|
||||
|
||||
// Jump
|
||||
UpdateFloatValue(jumpPower, ref agent.data.jumpPower, ref agent.defaultData.jumpPower);
|
||||
UpdateFloatValue(jumpPowerDecay, ref agent.data.jumpPowerDecay, ref agent.defaultData.jumpPowerDecay);
|
||||
|
||||
// Gravity
|
||||
UpdateFloatValue(gravityPower, ref agent.data.gravityPower, ref agent.defaultData.gravityPower);
|
||||
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.defaultData.settingsChangeSmoothing);
|
||||
|
||||
// Rotation
|
||||
UpdateEnumValue(rotateFacing, ref agent.data.rotateFacing, ref agent.defaultData.rotateFacing);
|
||||
UpdateFloatValue(rotationSpeed, ref agent.data.rotationSpeed, ref agent.defaultData.rotationSpeed);
|
||||
UpdateFloatValue(rotationSmoothing, ref agent.data.rotationSmoothing, ref agent.defaultData.rotationSmoothing);
|
||||
UpdateFloatValue(rotationInputBlending, ref agent.data.rotationInputBlending, ref agent.defaultData.rotationInputBlending);
|
||||
// // Direction
|
||||
// FloatValueGroup.UpdateValue(airDirectionDecay, ref agent.data.airDirectionDecay, ref agent.defaultData.airDirectionDecay);
|
||||
// FloatValueGroup.ChangeSmoothingEasing(airDirectionDecay,
|
||||
// ref agent.smoothing.airDirectionDecay,
|
||||
// ref agent.easing.airDirectionDecay,
|
||||
// ref agent.defaultSmoothing.airDirectionDecay,
|
||||
// ref agent.defaultEasing.airDirectionDecay
|
||||
// );
|
||||
//
|
||||
// UpdateFloatValue(accelerationSmoothing, ref agent.data.accelerationSmoothing, ref agent.defaultData.accelerationSmoothing);
|
||||
// UpdateFloatValue(deaccelerationSmoothing, ref agent.data.deaccelerationSmoothing, ref agent.defaultData.deaccelerationSmoothing);
|
||||
// // UpdateCurveProperty(deaccelerationCurve, ref agent.data.deaccelerationCurve, ref agent.defaultData.deaccelerationCurve); // Currently unused, may return
|
||||
//
|
||||
//
|
||||
//
|
||||
// // Move Speed
|
||||
// UpdateFloatValue(moveSpeed, ref agent.data.moveSpeed, ref agent.defaultData.moveSpeed);
|
||||
// UpdateFloatValue(moveSpeedSoothing, ref agent.data.moveSpeedSoothing, ref agent.defaultData.moveSpeedSoothing);
|
||||
//
|
||||
// // Jump
|
||||
// UpdateFloatValue(jumpPower, ref agent.data.jumpPower, ref agent.defaultData.jumpPower);
|
||||
// UpdateFloatValue(jumpPowerDecay, ref agent.data.jumpPowerDecay, ref agent.defaultData.jumpPowerDecay);
|
||||
//
|
||||
// // Gravity
|
||||
// UpdateFloatValue(gravityPower, ref agent.data.gravityPower, ref agent.defaultData.gravityPower);
|
||||
// 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.defaultData.settingsChangeSmoothing);
|
||||
//
|
||||
// // Rotation
|
||||
// UpdateEnumValue(rotateFacing, ref agent.data.rotateFacing, ref agent.defaultData.rotateFacing);
|
||||
// UpdateFloatValue(rotationSpeed, ref agent.data.rotationSpeed, ref agent.defaultData.rotationSpeed);
|
||||
// UpdateFloatValue(rotationSmoothing, ref agent.data.rotationSmoothing, ref agent.defaultData.rotationSmoothing);
|
||||
// UpdateFloatValue(rotationInputBlending, ref agent.data.rotationInputBlending, ref agent.defaultData.rotationInputBlending);
|
||||
|
||||
// Rotation from value
|
||||
if (feedNewRotation.value != Vector3.zero) {
|
||||
@@ -133,103 +120,5 @@ namespace Reset.Core {
|
||||
protected override void OnPause() {
|
||||
|
||||
}
|
||||
|
||||
public void UpdateCurveProperty(CurveValueGroup valueGroup, ref AnimationCurve targetProperty, ref AnimationCurve defaultProperty){
|
||||
switch (valueGroup.changeValue) {
|
||||
case ValueChangeAction.NoChange:
|
||||
break;
|
||||
case ValueChangeAction.NewValue:
|
||||
targetProperty = valueGroup.newValue;
|
||||
break;
|
||||
case ValueChangeAction.ResetValue:
|
||||
targetProperty = defaultProperty;
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateVector3Value(Vector3ValueGroup valueGroup, ref Vector3 targetProperty, ref Vector3 defaultProperty){
|
||||
switch (valueGroup.changeX) {
|
||||
case ValueChangeAction.NewValue:
|
||||
targetProperty.x = valueGroup.newValue.x;
|
||||
break;
|
||||
case ValueChangeAction.ResetValue:
|
||||
targetProperty.x = defaultProperty.x;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (valueGroup.changeY) {
|
||||
case ValueChangeAction.NewValue:
|
||||
targetProperty.y = valueGroup.newValue.y;
|
||||
break;
|
||||
case ValueChangeAction.ResetValue:
|
||||
targetProperty.y = defaultProperty.y;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (valueGroup.changeZ) {
|
||||
case ValueChangeAction.NewValue:
|
||||
targetProperty.z = valueGroup.newValue.z;
|
||||
break;
|
||||
case ValueChangeAction.ResetValue:
|
||||
targetProperty.z = defaultProperty.z;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateVector2Value(Vector2ValueGroup valueGroup, ref Vector2 targetProperty, ref Vector2 defaultProperty){
|
||||
switch (valueGroup.changeX) {
|
||||
case ValueChangeAction.NewValue:
|
||||
targetProperty.x = valueGroup.newValue.x;
|
||||
break;
|
||||
case ValueChangeAction.ResetValue:
|
||||
targetProperty.x = defaultProperty.x;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (valueGroup.changeY) {
|
||||
case ValueChangeAction.NewValue:
|
||||
targetProperty.y = valueGroup.newValue.y;
|
||||
break;
|
||||
case ValueChangeAction.ResetValue:
|
||||
targetProperty.y = defaultProperty.y;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void UpdateBoolValue(BoolValueGroup valueGroup, ref bool targetProperty, ref bool defaultProperty){
|
||||
switch (valueGroup.changeValue) {
|
||||
case ValueChangeAction.NewValue:
|
||||
targetProperty = valueGroup.value;
|
||||
break;
|
||||
case ValueChangeAction.ResetValue:
|
||||
targetProperty = defaultProperty;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateEnumValue(EnumValueGroup valueGroup, ref Enum targetProperty, ref Enum defaultProperty){
|
||||
switch (valueGroup.changeValue) {
|
||||
case ValueChangeAction.NewValue:
|
||||
targetProperty = valueGroup.newValue;
|
||||
break;
|
||||
case ValueChangeAction.ResetValue:
|
||||
targetProperty = defaultProperty;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateFloatValue(FloatValueGroup valueGroup, ref float targetProperty, ref float defaultProperty){
|
||||
switch (valueGroup.changeValue) {
|
||||
case ValueChangeAction.NewValue:
|
||||
targetProperty = valueGroup.value.value;
|
||||
break;
|
||||
case ValueChangeAction.ResetValue:
|
||||
targetProperty = defaultProperty;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7879b20d5bcdf974c823d1919491e026
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,67 @@
|
||||
using NodeCanvas.Framework;
|
||||
using ParadoxNotion.Design;
|
||||
using Reset.Core;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
namespace Reset.Units {
|
||||
|
||||
[Category("Reset/Movement")]
|
||||
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;
|
||||
|
||||
//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() {
|
||||
// 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);
|
||||
}
|
||||
|
||||
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: e97f34b81238a9548b0bf4f5b68c8f17
|
||||
@@ -0,0 +1,54 @@
|
||||
using NodeCanvas.Framework;
|
||||
using ParadoxNotion.Design;
|
||||
using Reset.Core;
|
||||
|
||||
|
||||
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");
|
||||
|
||||
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");
|
||||
|
||||
//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() {
|
||||
// Jump
|
||||
FloatValueGroup.UpdateValue(jumpPower, ref agent.data.jumpPower, ref agent.defaultData.jumpPower);
|
||||
FloatValueGroup.UpdateValue(jumpPowerDecay, ref agent.data.jumpPowerDecay, ref agent.defaultData.jumpPowerDecay);
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
//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: 67c9324e429e09f4da157ab85dadacff
|
||||
@@ -0,0 +1,38 @@
|
||||
using NodeCanvas.Framework;
|
||||
using ParadoxNotion.Design;
|
||||
|
||||
|
||||
namespace Reset.Units {
|
||||
|
||||
[Category("Reset/Movement")]
|
||||
public class ChangeMoveSpeedSettings : ActionTask<UnitMovementHandler> {
|
||||
|
||||
//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() {
|
||||
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: c1f858e8bdedb4f46ac3e10c0dccde29
|
||||
@@ -0,0 +1,38 @@
|
||||
using NodeCanvas.Framework;
|
||||
using ParadoxNotion.Design;
|
||||
|
||||
|
||||
namespace Reset.Units {
|
||||
|
||||
[Category("Reset/Movement")]
|
||||
public class ChangeRotationSettings : ActionTask<UnitMovementHandler> {
|
||||
|
||||
//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() {
|
||||
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: 2af547219746e194f97217fe24cfb8cd
|
||||
@@ -1,496 +1,311 @@
|
||||
using System;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
using NodeCanvas.Editor;
|
||||
#endif
|
||||
|
||||
using NodeCanvas.Framework;
|
||||
using ParadoxNotion.Design;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Reset.Core{
|
||||
// Individual bool setting for each ring. Three of these will be used.
|
||||
public struct OrbitalFollowValueGroup{
|
||||
public string label;
|
||||
|
||||
public ValueChangeAction changeHeight;
|
||||
public float height;
|
||||
|
||||
public ValueChangeAction changeRadius;
|
||||
public float radius;
|
||||
public abstract class ValueGroup{
|
||||
public interface ISmoothable{
|
||||
public BBParameter<ValueChangeAction> changeEasing{ get; set; }
|
||||
public BBParameter<ValueChangeAction> changeSmoothing{ get; set; }
|
||||
|
||||
public OrbitalFollowValueGroup(string newLabel){
|
||||
label = newLabel;
|
||||
changeHeight = ValueChangeAction.NoChange;
|
||||
height = 0f;
|
||||
changeRadius = ValueChangeAction.NoChange;
|
||||
radius = 0f;
|
||||
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 camera settings
|
||||
|
||||
// Enum options for individual settings
|
||||
public enum ValueChangeAction{
|
||||
NoChange,
|
||||
NewValue,
|
||||
ResetValue,
|
||||
RelativeValue, // Placeholder for using as altering existing value
|
||||
}
|
||||
|
||||
public struct CurveValueGroup{
|
||||
|
||||
// Individual bool setting for each ring. Three of these will be used.
|
||||
public struct OrbitalFollowValueGroup : ValueGroup.ISmoothable{
|
||||
public string label;
|
||||
public AnimationCurve newValue;
|
||||
|
||||
public ValueChangeAction changeValue;
|
||||
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;
|
||||
|
||||
newValue = new AnimationCurve();
|
||||
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{
|
||||
public struct EnumValueGroup{ // Done
|
||||
public string label;
|
||||
public Enum newValue;
|
||||
public BBParameter<Enum> value;
|
||||
|
||||
public ValueChangeAction changeValue;
|
||||
public BBParameter<ValueChangeAction> changeValue;
|
||||
|
||||
public EnumValueGroup(string newLabel, Enum enumType){
|
||||
changeValue = ValueChangeAction.NoChange;
|
||||
|
||||
newValue = enumType;
|
||||
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{
|
||||
|
||||
public struct Vector3ValueGroup{ // Done
|
||||
public string label;
|
||||
public Vector3 newValue;
|
||||
|
||||
public ValueChangeAction changeX;
|
||||
public ValueChangeAction changeY;
|
||||
public ValueChangeAction changeZ;
|
||||
|
||||
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;
|
||||
|
||||
newValue = Vector3.zero;
|
||||
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{
|
||||
public struct Vector2ValueGroup : ValueGroup.ISmoothable{ // Done
|
||||
public string label;
|
||||
public Vector2 newValue;
|
||||
public BBParameter<Vector2> value;
|
||||
|
||||
public ValueChangeAction changeX;
|
||||
public ValueChangeAction changeY;
|
||||
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;
|
||||
|
||||
newValue = Vector2.zero;
|
||||
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 struct FloatValueGroup{
|
||||
public string label;
|
||||
// public float value;
|
||||
public BBParameter<float> value;
|
||||
|
||||
public ValueChangeAction changeValue;
|
||||
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 bool value;
|
||||
public BBParameter<bool> value;
|
||||
|
||||
public ValueChangeAction changeValue;
|
||||
public BBParameter<ValueChangeAction> changeValue;
|
||||
|
||||
public BoolValueGroup(string newLabel){
|
||||
label = newLabel;
|
||||
value = true;
|
||||
changeValue = ValueChangeAction.NoChange;
|
||||
}
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
public class BoolValueGroupDrawer : ObjectDrawer<BoolValueGroup> {
|
||||
public override BoolValueGroup OnGUI(GUIContent _content, BoolValueGroup _instance){
|
||||
// Remove label for floats
|
||||
EditorGUIUtility.labelWidth = 50;
|
||||
|
||||
// Set layout options for the label and the float fields
|
||||
GUILayoutOption[] floatOptions = new GUILayoutOption[] {
|
||||
GUILayout.Width(80.0f),
|
||||
GUILayout.MinWidth(20.0f),
|
||||
GUILayout.ExpandWidth(true),
|
||||
};
|
||||
|
||||
GUILayoutOption[] labelOptions = new GUILayoutOption[]{
|
||||
GUILayout.Width(200.0f),
|
||||
};
|
||||
|
||||
// Start the Vertical layout then add the label before adding a horizontal so the label will be on top of side-by-side options
|
||||
GUILayout.BeginVertical();
|
||||
GUILayout.Label(_instance.label, labelOptions);
|
||||
GUILayout.BeginHorizontal();
|
||||
|
||||
// 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.Toggle(_instance.value, floatOptions);
|
||||
} else {
|
||||
EditorGUI.BeginDisabledGroup(true);
|
||||
EditorGUILayout.TextField(_instance.changeValue == ValueChangeAction.NoChange ? "Unchanged" : "Reset", floatOptions);
|
||||
EditorGUI.EndDisabledGroup();
|
||||
}
|
||||
|
||||
// Close this line up
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.EndVertical();
|
||||
|
||||
// Reset to default so the rest of things don't get messed up
|
||||
EditorGUIUtility.labelWidth = 0;
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
|
||||
public class CurveVlueGroupDrawer : ObjectDrawer<CurveValueGroup> {
|
||||
public override CurveValueGroup OnGUI(GUIContent _content, CurveValueGroup _instance){
|
||||
// Remove label for floats
|
||||
EditorGUIUtility.labelWidth = 50;
|
||||
|
||||
// Set layout options for the label and the float fields
|
||||
GUILayoutOption[] floatOptions = new GUILayoutOption[] {
|
||||
GUILayout.Width(80.0f),
|
||||
GUILayout.MinWidth(20.0f),
|
||||
GUILayout.ExpandWidth(true),
|
||||
};
|
||||
|
||||
GUILayoutOption[] labelOptions = new GUILayoutOption[]{
|
||||
GUILayout.Width(200.0f),
|
||||
};
|
||||
|
||||
// Start the Vertical layout then add the label before adding a horizontal so the label will be on top of side-by-side options
|
||||
GUILayout.BeginVertical();
|
||||
GUILayout.Label(_instance.label, labelOptions);
|
||||
GUILayout.BeginHorizontal();
|
||||
|
||||
// Create the x settings enum
|
||||
_instance.changeValue = (ValueChangeAction)EditorGUILayout.EnumPopup("", instance.changeValue);
|
||||
|
||||
// Create the value/disabled information field
|
||||
if (_instance.changeValue == ValueChangeAction.NewValue){
|
||||
_instance.newValue = EditorGUILayout.CurveField(_instance.newValue, floatOptions);
|
||||
} else {
|
||||
EditorGUI.BeginDisabledGroup(true);
|
||||
EditorGUILayout.TextField(_instance.changeValue == ValueChangeAction.NoChange ? "Unchanged" : "Reset", floatOptions);
|
||||
EditorGUI.EndDisabledGroup();
|
||||
}
|
||||
|
||||
// Close this line up
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.EndVertical();
|
||||
|
||||
// Reset to default so the rest of things don't get messed up
|
||||
EditorGUIUtility.labelWidth = 0;
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
|
||||
public class EnumValueGroupDrawer : ObjectDrawer<EnumValueGroup>{
|
||||
public override EnumValueGroup OnGUI(GUIContent _content, EnumValueGroup _instance){
|
||||
// Set layout options for the label and the float fields
|
||||
GUILayoutOption[] floatOptions = new GUILayoutOption[] {
|
||||
GUILayout.Width(200.0f),
|
||||
GUILayout.MinWidth(100.0f),
|
||||
GUILayout.ExpandWidth(true),
|
||||
};
|
||||
|
||||
GUILayoutOption[] labelOptions = new GUILayoutOption[]{
|
||||
GUILayout.Width(200.0f),
|
||||
};
|
||||
|
||||
// Start the Vertical layout then add the label before adding a horizontal so the label will be on top of side-by-side options
|
||||
GUILayout.BeginVertical();
|
||||
GUILayout.Label(_instance.label, labelOptions);
|
||||
GUILayout.BeginHorizontal();
|
||||
|
||||
// Create the x settings enum
|
||||
_instance.changeValue = (ValueChangeAction)EditorGUILayout.EnumPopup("", instance.changeValue);
|
||||
|
||||
// Create the value/disabled information field
|
||||
if (_instance.changeValue == ValueChangeAction.NewValue){
|
||||
_instance.newValue = EditorGUILayout.EnumPopup("", instance.newValue, floatOptions);
|
||||
} else {
|
||||
EditorGUI.BeginDisabledGroup(true);
|
||||
EditorGUILayout.TextField(_instance.changeValue == ValueChangeAction.NoChange ? "Unchanged" : "Reset", floatOptions);
|
||||
EditorGUI.EndDisabledGroup();
|
||||
}
|
||||
|
||||
// Close this line up
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.EndVertical();
|
||||
|
||||
// Reset to default so the rest of things don't get messed up
|
||||
EditorGUIUtility.labelWidth = 0;
|
||||
return _instance;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class FloatValueGroupDrawer : ObjectDrawer<FloatValueGroup> {
|
||||
public override FloatValueGroup OnGUI(GUIContent _content, FloatValueGroup _instance){
|
||||
// Remove label for floats
|
||||
EditorGUIUtility.labelWidth = 50;
|
||||
|
||||
// Set layout options for the label and the float fields
|
||||
GUILayoutOption[] floatOptions = new GUILayoutOption[] {
|
||||
GUILayout.Width(80.0f),
|
||||
GUILayout.MinWidth(20.0f),
|
||||
GUILayout.ExpandWidth(true),
|
||||
};
|
||||
|
||||
GUILayoutOption[] labelOptions = new GUILayoutOption[]{
|
||||
GUILayout.Width(200.0f),
|
||||
};
|
||||
|
||||
// Start the Vertical layout then add the label before adding a horizontal so the label will be on top of side-by-side options
|
||||
GUILayout.BeginVertical();
|
||||
GUILayout.Label(_instance.label, labelOptions);
|
||||
GUILayout.BeginHorizontal();
|
||||
|
||||
// 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);
|
||||
BBParameterEditor.ParameterField("", _instance.value);
|
||||
} else {
|
||||
EditorGUI.BeginDisabledGroup(true);
|
||||
EditorGUILayout.TextField(_instance.changeValue == ValueChangeAction.NoChange ? "Unchanged" : "Reset", floatOptions);
|
||||
EditorGUI.EndDisabledGroup();
|
||||
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;
|
||||
}
|
||||
|
||||
// Close this line up
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.EndVertical();
|
||||
|
||||
// Reset to default so the rest of things don't get messed up
|
||||
EditorGUIUtility.labelWidth = 0;
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
|
||||
public class Vector3ValueGroupDrawer : ObjectDrawer<Vector3ValueGroup> {
|
||||
public override Vector3ValueGroup OnGUI(GUIContent _content, Vector3ValueGroup _instance){
|
||||
// Remove label for floats
|
||||
EditorGUIUtility.labelWidth = 20;
|
||||
|
||||
// Set layout options for the label and the float fields
|
||||
GUILayoutOption[] floatOptions = new GUILayoutOption[] {
|
||||
GUILayout.Width(300.0f),
|
||||
GUILayout.MinWidth(20.0f),
|
||||
GUILayout.ExpandWidth(true),
|
||||
};
|
||||
|
||||
GUILayoutOption[] labelOptions = new GUILayoutOption[]{
|
||||
GUILayout.Width(200.0f),
|
||||
};
|
||||
|
||||
// Start the Vertical layout then add the label before adding a horizontal so the label will be on top of side-by-side options
|
||||
GUILayout.BeginVertical();
|
||||
GUILayout.Label(_instance.label, labelOptions);
|
||||
GUILayout.BeginHorizontal();
|
||||
|
||||
// Create the x settings enum
|
||||
_instance.changeX = (ValueChangeAction)EditorGUILayout.EnumPopup("", instance.changeX);
|
||||
|
||||
// Create the value/disabled information field
|
||||
if (_instance.changeX == ValueChangeAction.NewValue){
|
||||
_instance.newValue.x = EditorGUILayout.FloatField(_instance.newValue.x, floatOptions);
|
||||
} else {
|
||||
EditorGUI.BeginDisabledGroup(true);
|
||||
EditorGUILayout.TextField(_instance.changeX == ValueChangeAction.NoChange ? "Unchanged" : "Reset", floatOptions);
|
||||
EditorGUI.EndDisabledGroup();
|
||||
}
|
||||
|
||||
// It do what it do.
|
||||
GUILayout.Space(5);
|
||||
|
||||
// Create the y settings enum
|
||||
_instance.changeY = (ValueChangeAction)EditorGUILayout.EnumPopup("", _instance.changeY);
|
||||
|
||||
// Create the value/disabled information field
|
||||
if (_instance.changeY == ValueChangeAction.NewValue){
|
||||
_instance.newValue.y = EditorGUILayout.FloatField(_instance.newValue.y, floatOptions);
|
||||
} else {
|
||||
EditorGUI.BeginDisabledGroup(true);
|
||||
EditorGUILayout.TextField(_instance.changeY == ValueChangeAction.NoChange ? "Unchanged" : "Reset", floatOptions);
|
||||
EditorGUI.EndDisabledGroup();
|
||||
}
|
||||
|
||||
// It do what it do.
|
||||
GUILayout.Space(5);
|
||||
|
||||
// Create the y settings enum
|
||||
_instance.changeZ = (ValueChangeAction)EditorGUILayout.EnumPopup("", _instance.changeZ);
|
||||
|
||||
// Create the value/disabled information field
|
||||
if (_instance.changeZ == ValueChangeAction.NewValue){
|
||||
_instance.newValue.z = EditorGUILayout.FloatField(_instance.newValue.z, floatOptions);
|
||||
} else {
|
||||
EditorGUI.BeginDisabledGroup(true);
|
||||
EditorGUILayout.TextField(_instance.changeZ == ValueChangeAction.NoChange ? "Unchanged" : "Reset", floatOptions);
|
||||
EditorGUI.EndDisabledGroup();
|
||||
}
|
||||
|
||||
// Close this line up
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.EndVertical();
|
||||
|
||||
// Reset to default so the rest of things don't get messed up
|
||||
EditorGUIUtility.labelWidth = 0;
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
|
||||
public class Vector2ValueGroupDrawer : ObjectDrawer<Vector2ValueGroup> {
|
||||
public override Vector2ValueGroup OnGUI(GUIContent _content, Vector2ValueGroup _instance){
|
||||
// Remove label for floats
|
||||
EditorGUIUtility.labelWidth = 50;
|
||||
|
||||
// Set layout options for the label and the float fields
|
||||
GUILayoutOption[] floatOptions = new GUILayoutOption[] {
|
||||
GUILayout.Width(300.0f),
|
||||
GUILayout.MinWidth(20.0f),
|
||||
GUILayout.ExpandWidth(true),
|
||||
};
|
||||
|
||||
GUILayoutOption[] labelOptions = new GUILayoutOption[]{
|
||||
GUILayout.Width(200.0f),
|
||||
};
|
||||
|
||||
// Start the Vertical layout then add the label before adding a horizontal so the label will be on top of side-by-side options
|
||||
GUILayout.BeginVertical();
|
||||
GUILayout.Label(_instance.label, labelOptions);
|
||||
GUILayout.BeginHorizontal();
|
||||
|
||||
// Create the x settings enum
|
||||
_instance.changeX = (ValueChangeAction)EditorGUILayout.EnumPopup("", instance.changeX);
|
||||
|
||||
// Create the value/disabled information field
|
||||
if (_instance.changeX == ValueChangeAction.NewValue){
|
||||
_instance.newValue.x = EditorGUILayout.FloatField(_instance.newValue.x, floatOptions);
|
||||
} else {
|
||||
EditorGUI.BeginDisabledGroup(true);
|
||||
EditorGUILayout.TextField(_instance.changeX == ValueChangeAction.NoChange ? "Unchanged" : "Reset", floatOptions);
|
||||
EditorGUI.EndDisabledGroup();
|
||||
}
|
||||
|
||||
// It do what it do.
|
||||
GUILayout.Space(5);
|
||||
|
||||
// Create the y settings enum
|
||||
_instance.changeY = (ValueChangeAction)EditorGUILayout.EnumPopup("", _instance.changeY);
|
||||
|
||||
// Create the value/disabled information field
|
||||
if (_instance.changeY == ValueChangeAction.NewValue){
|
||||
_instance.newValue.y = EditorGUILayout.FloatField(_instance.newValue.y, floatOptions);
|
||||
} else {
|
||||
EditorGUI.BeginDisabledGroup(true);
|
||||
EditorGUILayout.TextField(_instance.changeY == ValueChangeAction.NoChange ? "Unchanged" : "Reset", floatOptions);
|
||||
EditorGUI.EndDisabledGroup();
|
||||
}
|
||||
|
||||
// Close this line up
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.EndVertical();
|
||||
|
||||
// Reset to default so the rest of things don't get messed up
|
||||
EditorGUIUtility.labelWidth = 0;
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
|
||||
// Custom editor for each orbital follow ring setting
|
||||
public class OrbitalFollowValueGroupDrawer : ObjectDrawer<OrbitalFollowValueGroup>{
|
||||
public override OrbitalFollowValueGroup OnGUI(GUIContent _content, OrbitalFollowValueGroup _instance){
|
||||
// Remove label for floats
|
||||
EditorGUIUtility.labelWidth = 1;
|
||||
|
||||
// Set layout options for the label and the float fields
|
||||
GUILayoutOption[] floatOptions = new GUILayoutOption[] {
|
||||
GUILayout.Width(300.0f),
|
||||
GUILayout.MinWidth(20.0f),
|
||||
GUILayout.ExpandWidth(true),
|
||||
};
|
||||
|
||||
GUILayoutOption[] labelOptions = new GUILayoutOption[]{
|
||||
GUILayout.Width(60.0f),
|
||||
};
|
||||
|
||||
// Start a Horiztonal Section
|
||||
GUILayout.BeginHorizontal();
|
||||
|
||||
// Add the left side label
|
||||
GUILayout.Label(_instance.label, labelOptions);
|
||||
|
||||
// Create the height settings enum
|
||||
_instance.changeHeight = (ValueChangeAction)EditorGUILayout.EnumPopup("", _instance.changeHeight);
|
||||
|
||||
// Create the value/disabled information field
|
||||
if (_instance.changeHeight == ValueChangeAction.NewValue){
|
||||
_instance.height = EditorGUILayout.FloatField(_instance.height, floatOptions);
|
||||
} else {
|
||||
EditorGUI.BeginDisabledGroup(true);
|
||||
EditorGUILayout.TextField(_instance.changeHeight == ValueChangeAction.NoChange ? "Unchanged" : "Reset", floatOptions);
|
||||
EditorGUI.EndDisabledGroup();
|
||||
}
|
||||
|
||||
// It do what it do.
|
||||
GUILayout.Space(5);
|
||||
|
||||
// Create the radius settings enum
|
||||
_instance.changeRadius = (ValueChangeAction)EditorGUILayout.EnumPopup("", _instance.changeRadius);
|
||||
|
||||
// Create the value/disabled information field
|
||||
if (_instance.changeRadius == ValueChangeAction.NewValue){
|
||||
_instance.radius = EditorGUILayout.FloatField(_instance.radius, floatOptions);
|
||||
} else {
|
||||
EditorGUI.BeginDisabledGroup(true);
|
||||
EditorGUILayout.TextField(_instance.changeRadius == ValueChangeAction.NoChange ? "Unchanged" : "Reset", floatOptions);
|
||||
EditorGUI.EndDisabledGroup();
|
||||
}
|
||||
|
||||
// Close this line up
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
// Reset to default so the rest of things don't get messed up
|
||||
EditorGUIUtility.labelWidth = 0;
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
454
Assets/Scripts/Core/ValueGroupEditors.cs
Normal file
454
Assets/Scripts/Core/ValueGroupEditors.cs
Normal file
@@ -0,0 +1,454 @@
|
||||
using NodeCanvas.Editor;
|
||||
using ParadoxNotion.Design;
|
||||
using Reset.Core;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
public class BoolValueGroupDrawer : ObjectDrawer<BoolValueGroup> {
|
||||
public override BoolValueGroup OnGUI(GUIContent _content, BoolValueGroup _instance){
|
||||
// Remove label for floats
|
||||
EditorGUIUtility.labelWidth = 50;
|
||||
|
||||
// Set layout options for the label and the float fields
|
||||
GUILayoutOption[] floatOptions = new GUILayoutOption[] {
|
||||
GUILayout.Width(80.0f),
|
||||
GUILayout.MinWidth(20.0f),
|
||||
GUILayout.ExpandWidth(true),
|
||||
};
|
||||
|
||||
GUILayoutOption[] labelOptions = new GUILayoutOption[]{
|
||||
GUILayout.Width(200.0f),
|
||||
};
|
||||
|
||||
// Start the Vertical layout then add the label before adding a horizontal so the label will be on top of side-by-side options
|
||||
GUILayout.BeginVertical();
|
||||
GUILayout.Label(_instance.label, labelOptions);
|
||||
GUILayout.BeginHorizontal();
|
||||
|
||||
// Create the x settings enum
|
||||
_instance.changeValue = (ValueChangeAction)EditorGUILayout.EnumPopup("", instance.changeValue.value);
|
||||
|
||||
// Create the value/disabled information field
|
||||
if (_instance.changeValue.value == ValueChangeAction.NewValue){
|
||||
_instance.value = EditorGUILayout.Toggle(_instance.value.value, floatOptions);
|
||||
} else {
|
||||
EditorGUI.BeginDisabledGroup(true);
|
||||
EditorGUILayout.TextField(_instance.changeValue.value == ValueChangeAction.NoChange ? "Unchanged" : "Reset", floatOptions);
|
||||
EditorGUI.EndDisabledGroup();
|
||||
}
|
||||
|
||||
// Close this line up
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.EndVertical();
|
||||
|
||||
// Reset to default so the rest of things don't get messed up
|
||||
EditorGUIUtility.labelWidth = 0;
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class CurveValueGroupDrawer : ObjectDrawer<CurveValueGroup> {
|
||||
public override CurveValueGroup OnGUI(GUIContent _content, CurveValueGroup _instance){
|
||||
// Remove label for floats
|
||||
EditorGUIUtility.labelWidth = 50;
|
||||
|
||||
// Set layout options for the label and the float fields
|
||||
GUILayoutOption[] floatOptions = new GUILayoutOption[] {
|
||||
GUILayout.Width(80.0f),
|
||||
GUILayout.MinWidth(20.0f),
|
||||
GUILayout.ExpandWidth(true),
|
||||
};
|
||||
|
||||
GUILayoutOption[] labelOptions = new GUILayoutOption[]{
|
||||
GUILayout.Width(200.0f),
|
||||
};
|
||||
|
||||
// Start the Vertical layout then add the label before adding a horizontal so the label will be on top of side-by-side options
|
||||
GUILayout.BeginVertical();
|
||||
GUILayout.Label(_instance.label, labelOptions);
|
||||
GUILayout.BeginHorizontal();
|
||||
|
||||
// Create the x settings enum
|
||||
_instance.changeValue.value = (ValueChangeAction)EditorGUILayout.EnumPopup("", instance.changeValue.value);
|
||||
|
||||
// Create the value/disabled information field
|
||||
if (_instance.changeValue.value == ValueChangeAction.NewValue){
|
||||
BBParameterEditor.ParameterField("", _instance.value);
|
||||
} else {
|
||||
EditorGUI.BeginDisabledGroup(true);
|
||||
EditorGUILayout.TextField(_instance.changeValue.value == ValueChangeAction.NoChange ? "Unchanged" : "Reset", floatOptions);
|
||||
EditorGUI.EndDisabledGroup();
|
||||
}
|
||||
|
||||
// Close this line up
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.EndVertical();
|
||||
|
||||
// Reset to default so the rest of things don't get messed up
|
||||
EditorGUIUtility.labelWidth = 0;
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
|
||||
public class EnumValueGroupDrawer : ObjectDrawer<EnumValueGroup>{
|
||||
public override EnumValueGroup OnGUI(GUIContent _content, EnumValueGroup _instance){
|
||||
// Set layout options for the label and the float fields
|
||||
GUILayoutOption[] floatOptions = new GUILayoutOption[] {
|
||||
GUILayout.Width(200.0f),
|
||||
GUILayout.MinWidth(100.0f),
|
||||
GUILayout.ExpandWidth(true),
|
||||
};
|
||||
|
||||
GUILayoutOption[] labelOptions = new GUILayoutOption[]{
|
||||
GUILayout.Width(200.0f),
|
||||
};
|
||||
|
||||
// Start the Vertical layout then add the label before adding a horizontal so the label will be on top of side-by-side options
|
||||
GUILayout.BeginVertical();
|
||||
GUILayout.Label(_instance.label, labelOptions);
|
||||
GUILayout.BeginHorizontal();
|
||||
|
||||
// Create the x settings enum
|
||||
_instance.changeValue.value = (ValueChangeAction)EditorGUILayout.EnumPopup("", instance.changeValue.value);
|
||||
|
||||
// Create the value/disabled information field
|
||||
if (_instance.changeValue.value == ValueChangeAction.NewValue){
|
||||
_instance.value.value = EditorGUILayout.EnumPopup("", instance.value.value, floatOptions);
|
||||
} else {
|
||||
EditorGUI.BeginDisabledGroup(true);
|
||||
EditorGUILayout.TextField((ValueChangeAction)_instance.value.value == ValueChangeAction.NoChange ? "Unchanged" : "Reset", floatOptions);
|
||||
EditorGUI.EndDisabledGroup();
|
||||
}
|
||||
|
||||
// Close this line up
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.EndVertical();
|
||||
|
||||
// Reset to default so the rest of things don't get messed up
|
||||
EditorGUIUtility.labelWidth = 0;
|
||||
return _instance;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class FloatValueGroupDrawer : ObjectDrawer<FloatValueGroup> {
|
||||
public override FloatValueGroup OnGUI(GUIContent _content, FloatValueGroup _instance){
|
||||
// Remove label for floats
|
||||
EditorGUIUtility.labelWidth = 50;
|
||||
|
||||
// Start the label
|
||||
GUILayout.BeginHorizontal();
|
||||
// Set layout options for the label and the float fields
|
||||
GUILayoutOption[] floatOptions = new GUILayoutOption[] {
|
||||
GUILayout.Width(80.0f),
|
||||
GUILayout.MinWidth(20.0f),
|
||||
GUILayout.ExpandWidth(true),
|
||||
};
|
||||
|
||||
GUILayoutOption[] labelOptions = new GUILayoutOption[]{
|
||||
GUILayout.Width(200.0f),
|
||||
};
|
||||
|
||||
GUIStyle titleText = new GUIStyle{
|
||||
fontSize = 12,
|
||||
fontStyle = FontStyle.Bold,
|
||||
padding = new RectOffset(8, 0, 3,0),
|
||||
normal ={
|
||||
textColor = Color.white
|
||||
}
|
||||
};
|
||||
|
||||
// Start the Vertical layout then add the label before adding a horizontal so the label will be on top of side-by-side options
|
||||
GUILayout.Label(_instance.label, titleText);
|
||||
|
||||
// End the label
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
// Start the variables
|
||||
GUILayout.BeginHorizontal();
|
||||
|
||||
// Create the x settings enum
|
||||
// _instance.changeValue.value = (ValueChangeAction)EditorGUILayout.EnumPopup("", instance.changeValue.value);
|
||||
BBParameterEditor.ParameterField("", _instance.changeValue);
|
||||
|
||||
// Create the value/disabled information field
|
||||
if (_instance.changeValue.value == ValueChangeAction.NewValue){
|
||||
// _instance.value = EditorGUILayout.FloatField(_instance.value, floatOptions);
|
||||
BBParameterEditor.ParameterField("", _instance.value);
|
||||
} else {
|
||||
EditorGUI.BeginDisabledGroup(true);
|
||||
EditorGUILayout.TextField(_instance.changeValue.value == ValueChangeAction.NoChange ? "Unchanged" : "Reset", floatOptions);
|
||||
EditorGUI.EndDisabledGroup();
|
||||
}
|
||||
|
||||
// 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();
|
||||
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
|
||||
public class Vector3ValueGroupDrawer : ObjectDrawer<Vector3ValueGroup> {
|
||||
public override Vector3ValueGroup OnGUI(GUIContent _content, Vector3ValueGroup _instance){
|
||||
// Remove label for floats
|
||||
EditorGUIUtility.labelWidth = 20;
|
||||
|
||||
// Set layout options for the label and the float fields
|
||||
GUILayoutOption[] floatOptions = new GUILayoutOption[] {
|
||||
GUILayout.Width(300.0f),
|
||||
GUILayout.MinWidth(20.0f),
|
||||
GUILayout.ExpandWidth(true),
|
||||
};
|
||||
|
||||
GUILayoutOption[] labelOptions = new GUILayoutOption[]{
|
||||
GUILayout.Width(200.0f),
|
||||
};
|
||||
|
||||
// Start the Vertical layout then add the label before adding a horizontal so the label will be on top of side-by-side options
|
||||
GUILayout.BeginVertical();
|
||||
GUILayout.Label(_instance.label, labelOptions);
|
||||
GUILayout.BeginHorizontal();
|
||||
|
||||
// Create the x settings enum
|
||||
_instance.changeX.value = (ValueChangeAction)EditorGUILayout.EnumPopup("", instance.changeX.value);
|
||||
|
||||
// Create the value/disabled information field
|
||||
if (_instance.changeX.value== ValueChangeAction.NewValue) {
|
||||
var value = _instance.value.value;
|
||||
value.x = EditorGUILayout.FloatField(_instance.value.value.x, floatOptions);
|
||||
_instance.value.value = value;
|
||||
} else {
|
||||
EditorGUI.BeginDisabledGroup(true);
|
||||
EditorGUILayout.TextField(_instance.changeX.value == ValueChangeAction.NoChange ? "Unchanged" : "Reset", floatOptions);
|
||||
EditorGUI.EndDisabledGroup();
|
||||
}
|
||||
|
||||
// It do what it do.
|
||||
GUILayout.Space(5);
|
||||
|
||||
// Create the y settings enum
|
||||
_instance.changeY.value = (ValueChangeAction)EditorGUILayout.EnumPopup("", _instance.changeY.value);
|
||||
|
||||
// Create the value/disabled information field
|
||||
if (_instance.changeY.value == ValueChangeAction.NewValue) {
|
||||
var value = _instance.value.value;
|
||||
value.y = EditorGUILayout.FloatField(_instance.value.value.y, floatOptions);
|
||||
_instance.value.value = value;
|
||||
} else {
|
||||
EditorGUI.BeginDisabledGroup(true);
|
||||
EditorGUILayout.TextField(_instance.changeY.value == ValueChangeAction.NoChange ? "Unchanged" : "Reset", floatOptions);
|
||||
EditorGUI.EndDisabledGroup();
|
||||
}
|
||||
|
||||
// It do what it do.
|
||||
GUILayout.Space(5);
|
||||
|
||||
// Create the y settings enum
|
||||
_instance.changeZ.value = (ValueChangeAction)EditorGUILayout.EnumPopup("", _instance.changeZ.value);
|
||||
|
||||
// Create the value/disabled information field
|
||||
if (_instance.changeZ.value == ValueChangeAction.NewValue) {
|
||||
var value = _instance.value.value;
|
||||
value.z = EditorGUILayout.FloatField(_instance.value.value.z, floatOptions);
|
||||
_instance.value.value = value;
|
||||
} else {
|
||||
EditorGUI.BeginDisabledGroup(true);
|
||||
EditorGUILayout.TextField(_instance.changeZ.value == ValueChangeAction.NoChange ? "Unchanged" : "Reset", floatOptions);
|
||||
EditorGUI.EndDisabledGroup();
|
||||
}
|
||||
|
||||
// Close this line up
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.EndVertical();
|
||||
|
||||
// Reset to default so the rest of things don't get messed up
|
||||
EditorGUIUtility.labelWidth = 0;
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
|
||||
public class Vector2ValueGroupDrawer : ObjectDrawer<Vector2ValueGroup> {
|
||||
public override Vector2ValueGroup OnGUI(GUIContent _content, Vector2ValueGroup _instance){
|
||||
// Remove label for floats
|
||||
EditorGUIUtility.labelWidth = 50;
|
||||
|
||||
// Set layout options for the label and the float fields
|
||||
GUILayoutOption[] floatOptions = new GUILayoutOption[] {
|
||||
GUILayout.Width(300.0f),
|
||||
GUILayout.MinWidth(20.0f),
|
||||
GUILayout.ExpandWidth(true),
|
||||
};
|
||||
|
||||
GUILayoutOption[] labelOptions = new GUILayoutOption[]{
|
||||
GUILayout.Width(200.0f),
|
||||
};
|
||||
|
||||
// Start the Vertical layout then add the label before adding a horizontal so the label will be on top of side-by-side options
|
||||
GUILayout.BeginVertical();
|
||||
GUILayout.Label(_instance.label, labelOptions);
|
||||
GUILayout.BeginHorizontal();
|
||||
|
||||
// Create the x settings enum
|
||||
_instance.changeX.value = (ValueChangeAction)EditorGUILayout.EnumPopup("", instance.changeX.value);
|
||||
|
||||
// Create the value/disabled information field
|
||||
if (_instance.changeX.value == ValueChangeAction.NewValue) {
|
||||
var value = _instance.value.value;
|
||||
value.x = EditorGUILayout.FloatField(_instance.value.value.x, floatOptions);
|
||||
_instance.value.value = value;
|
||||
} else {
|
||||
EditorGUI.BeginDisabledGroup(true);
|
||||
EditorGUILayout.TextField(_instance.changeX.value == ValueChangeAction.NoChange ? "Unchanged" : "Reset", floatOptions);
|
||||
EditorGUI.EndDisabledGroup();
|
||||
}
|
||||
|
||||
// It do what it do.
|
||||
GUILayout.Space(5);
|
||||
|
||||
// Create the y settings enum
|
||||
_instance.changeY.value = (ValueChangeAction)EditorGUILayout.EnumPopup("", _instance.changeY.value);
|
||||
|
||||
// Create the value/disabled information field
|
||||
if (_instance.changeY.value == ValueChangeAction.NewValue) {
|
||||
var value = _instance.value.value;
|
||||
value.y = EditorGUILayout.FloatField(_instance.value.value.y, floatOptions);
|
||||
_instance.value.value = value;
|
||||
} else {
|
||||
EditorGUI.BeginDisabledGroup(true);
|
||||
EditorGUILayout.TextField(_instance.changeY.value == ValueChangeAction.NoChange ? "Unchanged" : "Reset", floatOptions);
|
||||
EditorGUI.EndDisabledGroup();
|
||||
}
|
||||
|
||||
// Close this line up
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.EndVertical();
|
||||
|
||||
// Reset to default so the rest of things don't get messed up
|
||||
EditorGUIUtility.labelWidth = 0;
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
|
||||
// Custom editor for each orbital follow ring setting
|
||||
public class OrbitalFollowValueGroupDrawer : ObjectDrawer<OrbitalFollowValueGroup>{
|
||||
public override OrbitalFollowValueGroup OnGUI(GUIContent _content, OrbitalFollowValueGroup _instance){
|
||||
// Remove label for floats
|
||||
EditorGUIUtility.labelWidth = 1;
|
||||
|
||||
// Set layout options for the label and the float fields
|
||||
GUILayoutOption[] floatOptions = new GUILayoutOption[] {
|
||||
GUILayout.Width(300.0f),
|
||||
GUILayout.MinWidth(20.0f),
|
||||
GUILayout.ExpandWidth(true),
|
||||
};
|
||||
|
||||
GUILayoutOption[] labelOptions = new GUILayoutOption[]{
|
||||
GUILayout.Width(60.0f),
|
||||
};
|
||||
|
||||
// Start a Horiztonal Section
|
||||
GUILayout.BeginHorizontal();
|
||||
|
||||
// Add the left side label
|
||||
GUILayout.Label(_instance.label, labelOptions);
|
||||
|
||||
// Create the height settings enum
|
||||
_instance.changeHeight.value = (ValueChangeAction)EditorGUILayout.EnumPopup("", _instance.changeHeight.value);
|
||||
|
||||
// Create the value/disabled information field
|
||||
if (_instance.changeHeight.value == ValueChangeAction.NewValue){
|
||||
_instance.height.value = EditorGUILayout.FloatField(_instance.height.value, floatOptions);
|
||||
} else {
|
||||
EditorGUI.BeginDisabledGroup(true);
|
||||
EditorGUILayout.TextField(_instance.changeHeight.value == ValueChangeAction.NoChange ? "Unchanged" : "Reset", floatOptions);
|
||||
EditorGUI.EndDisabledGroup();
|
||||
}
|
||||
|
||||
// It do what it do.
|
||||
GUILayout.Space(5);
|
||||
|
||||
// Create the radius settings enum
|
||||
_instance.changeRadius.value = (ValueChangeAction)EditorGUILayout.EnumPopup("", _instance.changeRadius.value);
|
||||
|
||||
// Create the value/disabled information field
|
||||
if (_instance.changeRadius.value == ValueChangeAction.NewValue){
|
||||
_instance.radius = EditorGUILayout.FloatField(_instance.radius.value, floatOptions);
|
||||
} else {
|
||||
EditorGUI.BeginDisabledGroup(true);
|
||||
EditorGUILayout.TextField(_instance.changeRadius.value == ValueChangeAction.NoChange ? "Unchanged" : "Reset", floatOptions);
|
||||
EditorGUI.EndDisabledGroup();
|
||||
}
|
||||
|
||||
// Close this line up
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
// Reset to default so the rest of things don't get messed up
|
||||
EditorGUIUtility.labelWidth = 0;
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
3
Assets/Scripts/Core/ValueGroupEditors.cs.meta
Normal file
3
Assets/Scripts/Core/ValueGroupEditors.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e327ef0e278a437486396775f36450dd
|
||||
timeCreated: 1758039991
|
||||
Reference in New Issue
Block a user