make frames show up properly

fix cart guy for real
This commit is contained in:
minenice55 2024-01-15 12:26:20 -05:00
parent 5225b95cc3
commit f6cec18904
2 changed files with 58 additions and 34 deletions

View file

@ -159,7 +159,8 @@ namespace HeavenStudio.Games
{
public int expression;
public double beat;
public Reaction(int expression, double beat) {
public Reaction(int expression, double beat)
{
this.expression = expression;
this.beat = beat;
}
@ -260,7 +261,7 @@ namespace HeavenStudio.Games
float normalizedBeat = cond.GetPositionFromBeat(gearEase.beat, gearEase.length);
Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction(gearEase.ease);
currentGearSpeed = func(oldGearSpeed, newGearSpeed, normalizedBeat);
if (normalizedBeat >= 1) cartEase.length = 0;
if (normalizedBeat >= 1) gearEase.length = 0;
}
if (cartEase.length != 0)
@ -268,24 +269,32 @@ namespace HeavenStudio.Games
float normalizedBeat = cond.GetPositionFromBeat(cartEase.beat, cartEase.length);
Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction(cartEase.ease);
float newPos = func(0f, 1f, normalizedBeat);
Debug.Log($"{normalizedBeat}, {newPos}");
CartGuyParentAnim.DoNormalizedAnimation($"Move{cartDir}", newPos);
if (normalizedBeat >= 1) cartEase.length = 0;
}
CartGuyParentAnim.gameObject.SetActive(cartEase.length != 0);
if (cond.isPlaying && !cond.isPaused) {
foreach (Transform gear in Gears) {
if (cond.isPlaying && !cond.isPaused)
{
foreach (Transform gear in Gears)
{
double newZ = Time.deltaTime * currentGearSpeed * 50 * (gear.name == "Big" ? -1 : 1) / cond.pitchedSecPerBeat;
gear.Rotate(new Vector3(0, 0, (float)newZ));
}
}
if (cond.isPlaying) {
if (cond.isPlaying)
{
MeatSplash.Play();
} else if (cond.isPaused) {
}
else if (cond.isPaused)
{
MeatSplash.Pause();
} else {
}
else
{
MeatSplash.Stop();
}
}
@ -297,11 +306,15 @@ namespace HeavenStudio.Games
BossAnim.DoScaledAnimationAsync(bossAnnoyed ? "BossMiss" : "Bop", 0.5f);
}
if (CartGuyParentAnim.gameObject.activeSelf) {
if (CartGuyParentAnim.gameObject.activeSelf)
{
// Debug.Log(cartPhone ? "PhoneBop" : "Bop");
if (cartPhone) {
if (cartPhone)
{
CartGuyAnim.DoScaledAnimationAsync("PhoneBop", 0.5f);
} else {
}
else
{
CartGuyAnim.DoScaledAnimationAsync("Bop", 0.5f);
}
}
@ -326,15 +339,18 @@ namespace HeavenStudio.Games
{
List<RiqEntity> allEntities = GameManager.instance.Beatmap.Entities.FindAll(c => c.datamodel.Split('/')[0] == "meatGrinder");
RiqEntity cg = allEntities.Find(c => c.datamodel == "meatGrinder/cartGuy");
if (cg != null) {
if (cg != null)
{
CartGuy(cg.beat, cg.length, cg["spider"], cg["direction"], cg["ease"]);
}
RiqEntity gr = allEntities.Find(c => c.datamodel == "meatGrinder/gears");
if (gr != null) {
if (gr != null)
{
ChangeGears(gr.beat, gr.length, gr["ease"], gr["speed"]);
}
List<RiqEntity> meats = allEntities.FindAll(c => c.datamodel == "meatGrinder/MeatToss" && beat > c.beat && beat < c.beat + 1);
foreach (var meat in meats) {
foreach (var meat in meats)
{
MeatToss(meat.beat, meat["bacon"], meat["tackReaction"], meat["tackReactionBeats"], meat["bossReaction"], meat["bossReactionBeats"]);
}
}
@ -352,8 +368,10 @@ namespace HeavenStudio.Games
var actions = new List<BeatAction.Action>();
for (int i = 0; i < length; i++)
{
actions.Add(new BeatAction.Action(beat + i, delegate {
if (!BossAnim.IsPlayingAnimationNames("BossCall", "BossSignal")) {
actions.Add(new BeatAction.Action(beat + i, delegate
{
if (!BossAnim.IsPlayingAnimationNames("BossCall", "BossSignal"))
{
BossAnim.DoScaledAnimationAsync(bossAnnoyed ? "BossMiss" : "Bop", 0.5f);
}
}));
@ -364,11 +382,13 @@ namespace HeavenStudio.Games
public void DoExpressions(int tackExpression, int bossExpression = 0)
{
if (tackExpression != (int)TackExpressions.None) {
if (tackExpression != (int)TackExpressions.None)
{
string tackAnim = ((TackExpressions)tackExpression).ToString();
TackAnim.DoScaledAnimationAsync("Tack" + tackAnim, 0.5f);
}
if (bossExpression != (int)BossExpressions.None) {
if (bossExpression != (int)BossExpressions.None)
{
string bossAnim = ((BossExpressions)bossExpression).ToString();
BossAnim.DoScaledAnimationAsync("Boss" + bossAnim, 0.5f);
}
@ -376,21 +396,24 @@ namespace HeavenStudio.Games
public void CartGuy(double beat, float length, bool spider, int direction, int ease)
{
cartEase = new() {
cartPhone = spider;
cartDir = direction == 0 ? "Right" : "Left";
if (cartPhone)
{
CartGuyAnim.Play("Phone", 0, 0);
}
cartEase = new()
{
beat = beat,
length = length,
ease = (Util.EasingFunction.Ease)ease,
};
cartPhone = spider;
cartDir = direction == 0 ? "Right" : "Left";
if (cartPhone) {
CartGuyAnim.Play("Phone", 0, 0);
}
}
public void ChangeGears(double beat, float length, int ease, float speed)
{
gearEase = new() {
gearEase = new()
{
beat = beat,
length = length,
ease = (Util.EasingFunction.Ease)ease,
@ -487,7 +510,8 @@ namespace HeavenStudio.Games
private void PassTurn(double beat, double intervalBeat, float intervalLength, List<RiqEntity> allCallEvents = null)
{
if (allCallEvents == null) {
if (allCallEvents == null)
{
allCallEvents = GetRelevantMeatCallsBetweenBeat(intervalBeat, intervalBeat + intervalLength);
allCallEvents.Sort((x, y) => x.beat.CompareTo(y.beat));
}

View file

@ -260,13 +260,6 @@ namespace HeavenStudio
}
break;
}
epilogueFrame.sprite = rank switch
{
Rank.Ok => epilogueFrmOk,
Rank.Hi => epilogueFrmHi,
_ => epilogueFrmNg
};
}
header.text = playedBeatmap != null ? playedBeatmap["resultcaption"] : "Rhythm League Notes";
@ -303,6 +296,13 @@ namespace HeavenStudio
imageResource = playedBeatmap != null ? playedBeatmap["epilogue_hi_res"] : null;
}
epilogueFrame.sprite = rank switch
{
Rank.Ok => epilogueFrmOk,
Rank.Hi => epilogueFrmHi,
_ => epilogueFrmNg
};
if (imageResource != null)
{
imagePath = imageResource.Value.path;