Better Stomp Shake & Alternate BGs

Made the stomp shake look MUCH better, and added an option to poses to automatically alternate between background types.
This commit is contained in:
RaffyTaffy14 2024-04-08 01:35:28 -04:00
parent b8d9e6db62
commit 29ebd1376c
6 changed files with 141 additions and 42 deletions

View file

@ -2230,7 +2230,7 @@ MonoBehaviour:
camera: {fileID: 7621216590368296269}
cameraX: 0
cameraXNew: 0
stompShakeSpeed: 0.65
stompShakeSpeed: 0.125
--- !u!1 &2594614983758801598
GameObject:
m_ObjectHideFlags: 0

View file

@ -14,8 +14,8 @@ RenderTexture:
m_DownscaleFallback: 0
m_IsAlphaChannelOptional: 0
serializedVersion: 5
m_Width: 579
m_Height: 326
m_Width: 691
m_Height: 389
m_AntiAliasing: 2
m_MipCount: -1
m_DepthStencilFormat: 92

View file

@ -14,8 +14,8 @@ RenderTexture:
m_DownscaleFallback: 0
m_IsAlphaChannelOptional: 0
serializedVersion: 5
m_Width: 868
m_Height: 489
m_Width: 1036
m_Height: 583
m_AntiAliasing: 1
m_MipCount: -1
m_DepthStencilFormat: 92

View file

@ -213,9 +213,9 @@ TextureImporter:
name: ground
rect:
serializedVersion: 2
x: 770
x: 764
y: 81
width: 1187
width: 1192
height: 539
alignment: 5
pivot: {x: 1, y: 0.5}

View file

@ -28,6 +28,7 @@ using HeavenStudio.Util;
using HeavenStudio.InputSystem;
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
namespace HeavenStudio.Games.Loaders
@ -93,22 +94,25 @@ namespace HeavenStudio.Games.Loaders
new GameAction("endPose", "Finishing Pose")
{
function = delegate { var e = eventCaller.currentEntity; SumoBrothers.instance.EndPose(e.beat, e["random"], e["type"], e["bg"], e["confetti"]); },
function = delegate { var e = eventCaller.currentEntity; SumoBrothers.instance.EndPose(e.beat, e["random"], e["type"], e["bg"], e["confetti"], e["alternate"]); },
parameters = new List<Param>()
{ new Param("random", true, "Random Pose", "Picks a random pose that will play on a successful input. Does not include the finale pose.", new List<Param.CollapseParam>()
{
new Param.CollapseParam((x, _) => !(bool)x, new string[] { "type" })
}),
new Param("type", new EntityTypes.Integer(1, 3, 1), "Pose", "The pose that the Sumo Brothers will make."),
// add param to alternate bg
new Param("bg", SumoBrothers.BGType.None, "Background", "The background that appears on a successful input."),
new Param("confetti", false, "Confetti (WIP)", "Confetti particles will fly everywhere on a successful input.")
new Param("alternate", true, "Alternate Background", "Alternates between which of the backgrounds appear on a successful input.", new List<Param.CollapseParam>()
{
new Param.CollapseParam((x, _) => !(bool)x, new string[] { "bg" })
}),
new Param("bg", SumoBrothers.BGType.GreatWave, "Background", "The background that appears on a successful input."),
new Param("confetti", true, "Confetti (WIP)", "Confetti particles will fly everywhere on a successful input.")
},
defaultLength = 5f,
priority = 2
},
new GameAction("look", "Look Forward")
new GameAction("look", "Look at Camera")
{
function = delegate { var e = eventCaller.currentEntity; SumoBrothers.instance.LookAtCamera(e.beat, e.length); },
/*parameters = new List<Param>()
@ -162,6 +166,9 @@ namespace HeavenStudio.Games
private double stompShakeLength;
public double stompShakeSpeed;
public List<double> stompShakeTimings = new List<double>();
public List<float> stompShakeValues = new List<float>();
private bool goBopSumo;
private bool goBopInu;
@ -232,8 +239,8 @@ namespace HeavenStudio.Games
}
public static PlayerInput.InputAction InputAction_Alt =
new("CtrSumouAlt", new int[] { IAAltDownCat, IAAltDownCat, IAAltDownCat },
IA_PadAltPress, IA_TouchAltPress, IA_BatonAltPress);
new("CtrSumouAlt", new int[] { IAAltDownCat, IAFlickCat, IAAltDownCat },
IA_PadAltPress, IA_TouchFlick, IA_BatonAltPress);
// Start is called before the first frame update
@ -251,7 +258,6 @@ namespace HeavenStudio.Games
sumoPoseType = 0;
sumoPoseTypeNext = 0;
}
void OnDestroy()
@ -354,8 +360,8 @@ namespace HeavenStudio.Games
}
print("current sumo state: " + sumoState + " and previous sumo state: " + sumoStatePrevious);
print("sumo pose type: " + sumoPoseType);
//print("current sumo state: " + sumoState + " and previous sumo state: " + sumoStatePrevious);
//print("sumo pose type: " + sumoPoseType);
}
/*private void SetEndBeat(double beat) // code stolen from crop stomp, slightly modified
@ -541,7 +547,7 @@ namespace HeavenStudio.Games
print("sumo stomp dir: " + sumoStompDir);
//print("sumo stomp dir: " + sumoStompDir);
}
@ -630,7 +636,7 @@ namespace HeavenStudio.Games
print("the sumo slap direction:" + sumoSlapDir);
//print("the sumo slap direction:" + sumoSlapDir);
}
public void Crouch(double beat, float length, bool inu, bool sumo)
@ -656,16 +662,16 @@ namespace HeavenStudio.Games
new BeatAction.Action(beat, delegate { lookingAtCamera = true; }),
new BeatAction.Action(beat, delegate { sumoBrotherPHead.DoScaledAnimationAsync("SumoPSlapLook", 0.5f); }),
new BeatAction.Action(beat, delegate { sumoBrotherGHead.DoScaledAnimationAsync("SumoGSlapLook", 0.5f); }),
new BeatAction.Action(beat, delegate { print("look"); }),
//new BeatAction.Action(beat, delegate { print("look"); }),
new BeatAction.Action(beat + length, delegate { lookingAtCamera = false; }),
new BeatAction.Action(beat + length, delegate { if (sumoState == SumoState.Slap) sumoBrotherPHead.DoScaledAnimationAsync("SumoPSlap", 0.5f); }),
new BeatAction.Action(beat + length, delegate { if (sumoState == SumoState.Slap) sumoBrotherGHead.DoScaledAnimationAsync("SumoGSlap", 0.5f); }),
new BeatAction.Action(beat + length, delegate { print("lookun"); })
//new BeatAction.Action(beat + length, delegate { print("lookun"); })
});
}
}
public void EndPose(double beat, bool randomPose, int poseType, int backgroundType, bool confetti)
public void EndPose(double beat, bool randomPose, int poseType, int backgroundType, bool confetti, bool alternateBG)
{
if (cueCurrentlyActive)
{ return; }
@ -681,6 +687,12 @@ namespace HeavenStudio.Games
poseType = UnityEngine.Random.Range(1, 4);
}
if (alternateBG) {
if (bgType == BGType.None || bgType == BGType.OtaniOniji) { backgroundType = 0; } else {
backgroundType = 1; }
}
var cond = Conductor.instance;
ScheduleInput(beat, 4f, InputAction_Alt, PoseHit, PoseMiss, Nothing);
@ -848,8 +860,6 @@ namespace HeavenStudio.Games
void StompHit(PlayerActionEvent caller, float state)
{
justStompBeat = Conductor.instance.songPositionInBeatsAsDouble;
if (state >= 1f || state <= -1f)
{
SoundByte.PlayOneShotGame("sumoBrothers/tink");
@ -868,23 +878,62 @@ namespace HeavenStudio.Games
sumoBrotherP.DoScaledAnimationAsync("SumoStompR", 0.5f);
}
justStompBeat = Conductor.instance.songPositionInBeatsAsDouble;
// Attempt at making the code better, abandoned because the damn lists didn't cooperate
/*stompShakeTimings.Clear();
stompShakeValues.Clear();
for (int i = 0; i < 9; i++)
{
double currBeat = stompShakeSpeed * i + justStompBeat;
stompShakeTimings.Add(currBeat);
}
stompShakeValues.Add(-0.3f); // -0.3 0.3 -0.2 0.2 -0.1 0.1 -0.05 0
stompShakeValues.Add(0.3f);
stompShakeValues.Add(-0.2f);
stompShakeValues.Add(0.2f);
stompShakeValues.Add(-0.1f);
stompShakeValues.Add(0.1f);
stompShakeValues.Add(-0.05f);
stompShakeValues.Add(0f);*/
// yaaaay old crusty code
BeatAction.New(instance, new List<BeatAction.Action>() {
new BeatAction.Action(justStompBeat, delegate { stompShakeLength = 0.13; }),
new BeatAction.Action(justStompBeat, delegate { cameraXNew = -0.2f; }),
new BeatAction.Action(justStompBeat + 0.2, delegate { stompShakeLength = 0.25; }),
new BeatAction.Action(justStompBeat + 0.2, delegate { cameraX = cameraXNew; }),
new BeatAction.Action(justStompBeat + 0.2, delegate { cameraXNew = 0.2f; }),
new BeatAction.Action(justStompBeat + 0.4, delegate { stompShakeLength = 0.25; }),
new BeatAction.Action(justStompBeat + 0.4, delegate { cameraX = cameraXNew; }),
new BeatAction.Action(justStompBeat + 0.4, delegate { cameraXNew = -0.1f; }),
new BeatAction.Action(justStompBeat + 0.6, delegate { stompShakeLength = 0.25; }),
new BeatAction.Action(justStompBeat + 0.6, delegate { cameraX = cameraXNew; }),
new BeatAction.Action(justStompBeat + 0.6, delegate { cameraXNew = 0.05f; }),
new BeatAction.Action(justStompBeat + 0.8, delegate { stompShakeLength = 0.12; }),
new BeatAction.Action(justStompBeat + 0.8, delegate { cameraX = cameraXNew; }),
new BeatAction.Action(justStompBeat + 0.8, delegate { cameraXNew = 0f; }),
new BeatAction.Action(justStompBeat + 1, delegate { cameraX = cameraXNew; }),
});
//new BeatAction.Action(justStompBeat, delegate { stompShakeLength = 0.13; }),
new BeatAction.Action(justStompBeat, delegate { cameraXNew = -0.3f; }),
//new BeatAction.Action(justStompBeat + 0.2, delegate { stompShakeLength = 0.25; }),
new BeatAction.Action(justStompBeat + (stompShakeSpeed * 1), delegate { justStompBeat += stompShakeSpeed; }),
new BeatAction.Action(justStompBeat + (stompShakeSpeed * 1), delegate { cameraX = cameraXNew; }),
new BeatAction.Action(justStompBeat + (stompShakeSpeed * 1), delegate { cameraXNew = 0.3f; }),
//new BeatAction.Action(justStompBeat + 0.4, delegate { stompShakeLength = 0.25; }),
new BeatAction.Action(justStompBeat + (stompShakeSpeed * 2), delegate { justStompBeat += stompShakeSpeed; }),
new BeatAction.Action(justStompBeat + (stompShakeSpeed * 2), delegate { cameraX = cameraXNew; }),
new BeatAction.Action(justStompBeat + (stompShakeSpeed * 2), delegate { cameraXNew = -0.2f; }),
//new BeatAction.Action(justStompBeat + 0.6, delegate { stompShakeLength = 0.25; }),
new BeatAction.Action(justStompBeat + (stompShakeSpeed * 3), delegate { justStompBeat += stompShakeSpeed; }),
new BeatAction.Action(justStompBeat + (stompShakeSpeed * 3), delegate { cameraX = cameraXNew; }),
new BeatAction.Action(justStompBeat + (stompShakeSpeed * 3), delegate { cameraXNew = 0.2f; }),
//new BeatAction.Action(justStompBeat + 0.8, delegate { stompShakeLength = 0.12; }),
new BeatAction.Action(justStompBeat + (stompShakeSpeed * 4), delegate { justStompBeat += stompShakeSpeed; }),
new BeatAction.Action(justStompBeat + (stompShakeSpeed * 4), delegate { cameraX = cameraXNew; }),
new BeatAction.Action(justStompBeat + (stompShakeSpeed * 4), delegate { cameraXNew = -0.1f; }),
//
new BeatAction.Action(justStompBeat + (stompShakeSpeed * 5), delegate { justStompBeat += stompShakeSpeed; }),
new BeatAction.Action(justStompBeat + (stompShakeSpeed * 5), delegate { cameraX = cameraXNew; }),
new BeatAction.Action(justStompBeat + (stompShakeSpeed * 5), delegate { cameraXNew = 0.1f; }),
//
new BeatAction.Action(justStompBeat + (stompShakeSpeed * 6), delegate { justStompBeat += stompShakeSpeed; }),
new BeatAction.Action(justStompBeat + (stompShakeSpeed * 6), delegate { cameraX = cameraXNew; }),
new BeatAction.Action(justStompBeat + (stompShakeSpeed * 6), delegate { cameraXNew = -0.1f; }),
//
new BeatAction.Action(justStompBeat + (stompShakeSpeed * 7), delegate { justStompBeat += stompShakeSpeed; }),
new BeatAction.Action(justStompBeat + (stompShakeSpeed * 7), delegate { cameraX = cameraXNew; }),
new BeatAction.Action(justStompBeat + (stompShakeSpeed * 7), delegate { cameraXNew = 0f; }),
});
/*BeatAction.New(instance, new List<BeatAction.Action>() {
new BeatAction.Action(beat, delegate { allowBopInu = false; }),
@ -918,14 +967,32 @@ namespace HeavenStudio.Games
void StompShake()
{
// Attempt at making the code better, abandoned because the damn lists didn't cooperate
//var timings = stompShakeTimings.ToList();
//var values = stompShakeValues.ToList();
/*if (stompShakeTimings.Count == 0) { return; }
if (justStompBeat >= stompShakeTimings[0] && -1f != stompShakeValues[0])
{
justStompBeat = stompShakeTimings[0];
cameraX = cameraXNew;
cameraXNew = stompShakeValues[0];
stompShakeValues.RemoveAt(0);
stompShakeTimings.RemoveAt(0);
print(stompShakeTimings.Count + " " + stompShakeValues.Count);
print("cX: " + cameraX + " cXN: " + cameraXNew + "jSB: " + justStompBeat + "sST: " + stompShakeTimings + "sSV: " + stompShakeValues);
}*/
float normalizedBeat = Conductor.instance.GetPositionFromBeat(justStompBeat, stompShakeSpeed);
if (1.2f >= normalizedBeat)
if (1f >= normalizedBeat)
{
EasingFunction.Function func = EasingFunction.GetEasingFunction(EasingFunction.Ease.EaseInOutQuad);
float newPosX = func(cameraX, cameraXNew, normalizedBeat);
camera.position = new Vector3(newPosX, 0, 0);
print("cX: " + cameraX + " cXN: " + cameraXNew + "nPX: " + newPosX + "sSL: " + stompShakeLength);
//print("cX: " + cameraX + " cXN: " + cameraXNew + "nPX: " + newPosX + "sSL: " + stompShakeLength);
//print("cX: " + cameraX + " cXN: " + cameraXNew + " jSB: " + justStompBeat + " sST: " + stompShakeTimings + " sSV: " + stompShakeValues);
}
}

View file

@ -42,5 +42,37 @@ MonoBehaviour:
- Assets/Scripts/Util/SoundByte.cs
- Assets/Scripts/GameInitializer.cs
- Assets/Scripts/AppInfo.cs
- Assets/Scripts/Games/FanClub/NtrIdolFan.cs
- Assets/Scripts/Games/SneakySpirits/SneakySpirits.cs
- Assets/Scripts/Games/RhythmTweezers/RhythmTweezers.cs
- Assets/Scripts/LevelEditor/Timeline/SpecialTmeline/SpecialTimeline.cs
- Assets/Scripts/Games/DoubleDate/Basketball.cs
- Assets/Scripts/Games/CropStomp/Veggie.cs
- Assets/Scripts/Games/KarateMan/KarateManPot.cs
- Assets/Scripts/Games/FanClub/FanClub.cs
- Assets/Scripts/Games/NailCarpenter/LongNail.cs
- Assets/Scripts/LevelEditor/Timeline/SpecialTmeline/TimelineObjs/TempoTimelineObj.cs
- Assets/Scripts/Games/DoubleDate/Football.cs
- Assets/Scripts/Util/AnimationHelpers.cs
- Assets/Scripts/Games/DoubleDate/SoccerBall.cs
- Assets/Scripts/Games/PajamaParty/CtrPillowMonkey.cs
- Assets/Scripts/Games/DoubleDate/DoubleDate.cs
- Assets/Scripts/Games/SeeSaw/SeeSawGuy.cs
- Assets/Scripts/LevelEditor/Timeline/SpecialTmeline/TempoDialog.cs
- Assets/Scripts/Games/FanClub/NtrIdolAmie.cs
- Assets/Scripts/Games/PajamaParty/CtrPillowPlayer.cs
- Assets/Scripts/Games/MrUpbeat/MrUpbeat.cs
- Assets/Scripts/Games/NailCarpenter/Nail.cs
- Assets/Scripts/Games/RhythmTweezers/LongHair.cs
- Assets/Scripts/Games/WizardsWaltz/WizardsWaltz.cs
- Assets/Scripts/Games/KarateMan/KarateMan.cs
- Assets/Scripts/Games/SpaceSoccer/Ball.cs
- Assets/Scripts/Games/NailCarpenter/NailCarpenter.cs
- Assets/Scripts/Games/CatchyTune/Fruit.cs
- Assets/Scripts/Games/NailCarpenter/Sweet.cs
- Assets/Scripts/Games/WizardsWaltz/Wizard.cs
- Assets/Scripts/Games/PlayerActionEvent.cs
- Assets/Scripts/Games/BlueBear/Treat.cs
- Assets/Scripts/Games/SumoBrothers/SumoBrothers.cs
PathsToSkipImportEvent: []
PathsToIgnoreOverwriteSettingOnAttribute: []