change: gravity settings functions and deprecation of jump/gravity split

This commit is contained in:
Chris
2025-09-21 13:53:49 -04:00
parent 0fbef6aeee
commit d4231d4f38
5 changed files with 116 additions and 48 deletions

View File

@@ -27,19 +27,20 @@ namespace Reset.Units {
//Call EndAction() to mark the action as finished, either in success or failure.
//EndAction can be called from anywhere.
protected override void OnExecute() {
// Jump
FloatValueGroup.UpdateValue(jumpPower, ref agent.data.jumpPower.value, ref agent.defaultData.jumpPower.value);
ValueGroup.ChangeSmoothingEasing(jumpPower, ref agent.data.jumpPower.currentSmoothing,
ref agent.data.jumpPower.easing, ref agent.defaultData.jumpPower.smoothing, ref agent.defaultData.jumpPower.easing);
// Deprecated by unified gravity system, including SetNewGravity
// // Jump
// FloatValueGroup.UpdateValue(jumpPower, ref agent.data.jumpPower.value, ref agent.defaultData.jumpPower.value);
// ValueGroup.ChangeSmoothingEasing(jumpPower, ref agent.data.jumpPower.currentSmoothing,
// ref agent.data.jumpPower.easing, ref agent.defaultData.jumpPower.smoothing, ref agent.defaultData.jumpPower.easing);
FloatValueGroup.UpdateValue(jumpPowerDecay, 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.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);
// Deprecated by SetNewGravity
// FloatValueGroup.UpdateValue(gravityPower, ref agent.data.gravityPower.value, ref agent.defaultData.gravityPower.value);
// ValueGroup.ChangeSmoothingEasing(gravityPower, ref agent.data.gravityPower.currentSmoothing,
// ref agent.data.gravityPower.easing, ref agent.defaultData.gravityPower.smoothing, ref agent.defaultData.gravityPower.easing);
FloatValueGroup.UpdateValue(gravityMax, ref agent.data.gravityMax.value, ref agent.defaultData.gravityMax.value);
ValueGroup.ChangeSmoothingEasing(gravityMax, ref agent.data.gravityMax.currentSmoothing,

View File

@@ -16,4 +16,11 @@ public static class MathExtensions{
public static Color Alpha(this Color input, float newAlpha){
return new Color(input.r, input.g, input.b, newAlpha);
}
public static Vector2 Rotate(this Vector2 v, float delta) {
return new Vector2(
v.x * Mathf.Cos(delta) - v.y * Mathf.Sin(delta),
v.x * Mathf.Sin(delta) + v.y * Mathf.Cos(delta)
);
}
}