mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-12-29 02:51:12 +00:00
Ringside: Fixed the camera sometimes being zoomed out on game switch, fixed the newspaper having the miss pose when it shouldn't and fixed the kids laughter playing endlessly. (Generally cleaned up code too) (#260)
* Update Ringside.cs * make unwanted ringside inputs score misses update game icons * Camera doesn't zoom out when it shouldn't * Fixed the camera fr this time --------- Co-authored-by: minenice55 <star.elementa@gmail.com>
This commit is contained in:
parent
b5222b15c8
commit
5ce7862369
1 changed files with 147 additions and 268 deletions
|
@ -141,6 +141,7 @@ namespace HeavenStudio.Games
|
|||
private bool reporterShouldHeart;
|
||||
private bool hitPose;
|
||||
private bool shouldNotInput;
|
||||
private bool keepZoomOut;
|
||||
private Sound kidsLaugh;
|
||||
private int currentPose;
|
||||
private EasingFunction.Ease lastEase;
|
||||
|
@ -156,14 +157,7 @@ namespace HeavenStudio.Games
|
|||
void OnDestroy()
|
||||
{
|
||||
if (queuedPoses.Count > 0) queuedPoses.Clear();
|
||||
}
|
||||
|
||||
void OnGameSwitch(float beat)
|
||||
{
|
||||
shouldNotInput = false;
|
||||
shouldBop = true;
|
||||
lastCamPos = new Vector3(0, 0, -10);
|
||||
currentCamPos = new Vector3(0, 0, -10);
|
||||
Jukebox.KillLoop(kidsLaugh, 2f);
|
||||
}
|
||||
|
||||
public override void OnTimeChange()
|
||||
|
@ -191,6 +185,7 @@ namespace HeavenStudio.Games
|
|||
wrestlerAnim.Play("Idle", 0, 0);
|
||||
reporterAnim.Play("IdleReporter", 0, 0);
|
||||
shouldNotInput = false;
|
||||
shouldBop = true;
|
||||
}
|
||||
|
||||
void Update()
|
||||
|
@ -199,15 +194,18 @@ namespace HeavenStudio.Games
|
|||
|
||||
if (cond.isPlaying && !cond.isPaused)
|
||||
{
|
||||
if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1) && isPlaying(wrestlerAnim, "Idle") && shouldBop)
|
||||
if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1))
|
||||
{
|
||||
if (UnityEngine.Random.Range(1, 18) == 1)
|
||||
if (isPlaying(wrestlerAnim, "Idle") && shouldBop)
|
||||
{
|
||||
wrestlerAnim.DoScaledAnimationAsync("BopPec");
|
||||
}
|
||||
else
|
||||
{
|
||||
wrestlerAnim.DoScaledAnimationAsync("Bop");
|
||||
if (UnityEngine.Random.Range(1, 18) == 1)
|
||||
{
|
||||
wrestlerAnim.DoScaledAnimationAsync("BopPec");
|
||||
}
|
||||
else
|
||||
{
|
||||
wrestlerAnim.DoScaledAnimationAsync("Bop");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (PlayerInput.Pressed() && !IsExpectingInputNow(InputType.STANDARD_DOWN) && !shouldNotInput)
|
||||
|
@ -247,10 +245,15 @@ namespace HeavenStudio.Games
|
|||
}
|
||||
|
||||
float normalizedBeat = Conductor.instance.GetPositionFromBeat(currentZoomCamBeat, 2.5f);
|
||||
float normalizedShouldStopBeat = Conductor.instance.GetPositionFromBeat(currentZoomCamBeat, 3.99f);
|
||||
|
||||
if (normalizedBeat >= 0)
|
||||
{
|
||||
if (normalizedBeat > 1)
|
||||
if (normalizedShouldStopBeat > 1 && !keepZoomOut)
|
||||
{
|
||||
GameCamera.additionalPosition = new Vector3(0, 0, 0);
|
||||
}
|
||||
else if (normalizedBeat > 1)
|
||||
{
|
||||
GameCamera.additionalPosition = new Vector3(currentCamPos.x, currentCamPos.y, currentCamPos.z + 10);
|
||||
}
|
||||
|
@ -275,138 +278,7 @@ namespace HeavenStudio.Games
|
|||
{
|
||||
foreach (var p in queuedPoses)
|
||||
{
|
||||
if (p.newspaperBeats > 0)
|
||||
{
|
||||
reporterShouldHeart = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
reporterShouldHeart = false;
|
||||
}
|
||||
if (cond.songPositionInBeats - 0.05f > p.beat)
|
||||
{
|
||||
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(p.beat, delegate { wrestlerAnim.Play("PreparePoseIdle", 0, 0); }),
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(p.beat, delegate {wrestlerAnim.DoScaledAnimationAsync("PreparePose", 0.25f); }),
|
||||
});
|
||||
}
|
||||
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(p.beat, delegate {audienceAnim.DoScaledAnimationAsync("PoseAudience", 0.25f); }),
|
||||
new BeatAction.Action(p.beat, delegate {shouldBop = false; }),
|
||||
new BeatAction.Action(p.beat + 1, delegate { PoseCheck(p.beat); }),
|
||||
new BeatAction.Action(p.beat + 3.99f, delegate { wrestlerAnim.Play("Idle", 0, 0); }),
|
||||
new BeatAction.Action(p.beat + 3.99f, delegate { reporterAnim.Play("IdleReporter", 0, 0); }),
|
||||
new BeatAction.Action(p.beat + 3.99f, delegate { shouldNotInput = false; }),
|
||||
new BeatAction.Action(p.beat + 3.99f, delegate {shouldBop = true; }),
|
||||
});
|
||||
if (!p.keepZoomedOut)
|
||||
{
|
||||
if (p.newspaperBeats > 0)
|
||||
{
|
||||
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(p.beat + 3f, delegate
|
||||
{
|
||||
blackVoid.color = Color.black;
|
||||
newspaper.SetActive(true);
|
||||
if (UnityEngine.Random.Range(1, 3) == 1)
|
||||
{
|
||||
newspaper.GetComponent<Animator>().Play("NewspaperEnter", 0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
newspaper.GetComponent<Animator>().Play("NewspaperEnterRight", 0, 0);
|
||||
}
|
||||
if (hitPose)
|
||||
{
|
||||
wrestlerNewspaperAnim.Play($"Miss{UnityEngine.Random.Range(1, 7)}Newspaper", 0, 0);
|
||||
reporterNewspaperAnim.Play("IdleReporterNewspaper", 0, 0);
|
||||
kidsLaugh = Jukebox.PlayOneShotGame("ringside/kidslaugh", -1, 1, 1, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
wrestlerNewspaperAnim.Play($"Pose{currentPose}Newspaper", 0, 0);
|
||||
reporterNewspaperAnim.Play("HeartReporterNewspaper", 0, 0);
|
||||
hitPose = false;
|
||||
}
|
||||
}),
|
||||
new BeatAction.Action(p.beat + 3f + p.newspaperBeats, delegate
|
||||
{
|
||||
blackVoid.color = new Color(1f, 1f, 1f, 0);
|
||||
newspaper.SetActive(false);
|
||||
lastCamPos = new Vector3(0, 0, -10);
|
||||
currentCamPos = new Vector3(0, 0, -10);
|
||||
Jukebox.KillLoop(kidsLaugh, 0.25f);
|
||||
})
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(p.beat + 3.99, delegate
|
||||
{
|
||||
lastCamPos = new Vector3(0, 0, -10);
|
||||
currentCamPos = new Vector3(0, 0, -10);
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(p.beat + 2.5f, delegate
|
||||
{
|
||||
lastCamPos = currentCamPos;
|
||||
})
|
||||
});
|
||||
if (p.newspaperBeats > 0)
|
||||
{
|
||||
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(p.beat + 3f, delegate
|
||||
{
|
||||
blackVoid.color = Color.black;
|
||||
newspaper.SetActive(true);
|
||||
if (UnityEngine.Random.Range(1, 3) == 1)
|
||||
{
|
||||
newspaper.GetComponent<Animator>().Play("NewspaperEnter", 0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
newspaper.GetComponent<Animator>().Play("NewspaperEnterRight", 0, 0);
|
||||
}
|
||||
if (hitPose)
|
||||
{
|
||||
wrestlerNewspaperAnim.Play($"Miss{UnityEngine.Random.Range(1, 7)}Newspaper", 0, 0);
|
||||
reporterNewspaperAnim.Play("IdleReporterNewspaper", 0, 0);
|
||||
kidsLaugh = Jukebox.PlayOneShotGame("ringside/kidslaugh", -1, 1, 1, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
wrestlerNewspaperAnim.Play($"Pose{currentPose}Newspaper", 0, 0);
|
||||
reporterNewspaperAnim.Play("HeartReporterNewspaper", 0, 0);
|
||||
hitPose = false;
|
||||
}
|
||||
}),
|
||||
new BeatAction.Action(p.beat + 3f + p.newspaperBeats, delegate
|
||||
{
|
||||
blackVoid.color = new Color(1f, 1f, 1f, 0);
|
||||
newspaper.SetActive(false);
|
||||
Jukebox.KillLoop(kidsLaugh, 0.25f);
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
QueuePose(p.beat, p.keepZoomedOut, p.newspaperBeats);
|
||||
}
|
||||
queuedPoses.Clear();
|
||||
}
|
||||
|
@ -539,125 +411,7 @@ namespace HeavenStudio.Games
|
|||
}, forcePlay: true);
|
||||
if (GameManager.instance.currentGame == "ringside")
|
||||
{
|
||||
if (newspaperBeats > 0)
|
||||
{
|
||||
Ringside.instance.reporterShouldHeart = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Ringside.instance.reporterShouldHeart = false;
|
||||
}
|
||||
Ringside.instance.PoseCheck(beat);
|
||||
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(beat, delegate { Ringside.instance.audienceAnim.DoScaledAnimationAsync("PoseAudience", 0.25f); }),
|
||||
new BeatAction.Action(beat, delegate { Ringside.instance.wrestlerAnim.DoScaledAnimationAsync("PreparePose", 0.25f); }),
|
||||
new BeatAction.Action(beat, delegate { Ringside.instance.shouldBop = false; }),
|
||||
new BeatAction.Action(beat + 3.99f, delegate { Ringside.instance.wrestlerAnim.Play("Idle", 0, 0); }),
|
||||
new BeatAction.Action(beat + 3.99f, delegate { Ringside.instance.reporterAnim.Play("IdleReporter", 0, 0); }),
|
||||
new BeatAction.Action(beat + 3.99f, delegate { Ringside.instance.shouldNotInput = false; }),
|
||||
new BeatAction.Action(beat + 3.99f, delegate { Ringside.instance.shouldBop = true; }),
|
||||
});
|
||||
if (!keepZoomedOut)
|
||||
{
|
||||
if (newspaperBeats > 0)
|
||||
{
|
||||
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(beat + 3f, delegate
|
||||
{
|
||||
Ringside.instance.blackVoid.color = Color.black;
|
||||
Ringside.instance.newspaper.SetActive(true);
|
||||
if (UnityEngine.Random.Range(1, 3) == 1)
|
||||
{
|
||||
Ringside.instance.newspaper.GetComponent<Animator>().Play("NewspaperEnter", 0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
Ringside.instance.newspaper.GetComponent<Animator>().Play("NewspaperEnterRight", 0, 0);
|
||||
}
|
||||
if (!Ringside.instance.hitPose)
|
||||
{
|
||||
Ringside.instance.wrestlerNewspaperAnim.Play($"Miss{UnityEngine.Random.Range(1, 7)}Newspaper", 0, 0);
|
||||
Ringside.instance.reporterNewspaperAnim.Play("IdleReporterNewspaper", 0, 0);
|
||||
Ringside.instance.kidsLaugh = Jukebox.PlayOneShotGame("ringside/kidslaugh", -1, 1, 1, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
Ringside.instance.wrestlerNewspaperAnim.Play($"Pose{Ringside.instance.currentPose}Newspaper", 0, 0);
|
||||
Ringside.instance.reporterNewspaperAnim.Play("HeartReporterNewspaper", 0, 0);
|
||||
Ringside.instance.hitPose = false;
|
||||
}
|
||||
}),
|
||||
new BeatAction.Action(beat + 3f + newspaperBeats, delegate
|
||||
{
|
||||
Jukebox.KillLoop(Ringside.instance.kidsLaugh, 0.25f);
|
||||
Ringside.instance.blackVoid.color = new Color(1f, 1f, 1f, 0);
|
||||
Ringside.instance.newspaper.SetActive(false);
|
||||
Ringside.instance.lastCamPos = new Vector3(0, 0, -10);
|
||||
Ringside.instance.currentCamPos = new Vector3(0, 0, -10);
|
||||
})
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(beat + 3.99, delegate
|
||||
{
|
||||
Ringside.instance.lastCamPos = new Vector3(0, 0, -10);
|
||||
Ringside.instance.currentCamPos = new Vector3(0, 0, -10);
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(beat + 2.5f, delegate
|
||||
{
|
||||
Ringside.instance.lastCamPos = Ringside.instance.currentCamPos;
|
||||
})
|
||||
});
|
||||
if (newspaperBeats > 0)
|
||||
{
|
||||
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(beat + 3f, delegate
|
||||
{
|
||||
Ringside.instance.blackVoid.color = Color.black;
|
||||
Ringside.instance.newspaper.SetActive(true);
|
||||
if (UnityEngine.Random.Range(1, 3) == 1)
|
||||
{
|
||||
Ringside.instance.newspaper.GetComponent<Animator>().Play("NewspaperEnter", 0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
Ringside.instance.newspaper.GetComponent<Animator>().Play("NewspaperEnterRight", 0, 0);
|
||||
}
|
||||
if (!Ringside.instance.hitPose)
|
||||
{
|
||||
Ringside.instance.wrestlerNewspaperAnim.Play($"Miss{UnityEngine.Random.Range(1, 7)}Newspaper", 0, 0);
|
||||
Ringside.instance.reporterNewspaperAnim.Play("IdleReporterNewspaper", 0, 0);
|
||||
Ringside.instance.kidsLaugh = Jukebox.PlayOneShotGame("ringside/kidslaugh", -1, 1, 1, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
Ringside.instance.wrestlerNewspaperAnim.Play($"Pose{Ringside.instance.currentPose}Newspaper", 0, 0);
|
||||
Ringside.instance.reporterNewspaperAnim.Play("HeartReporterNewspaper", 0, 0);
|
||||
Ringside.instance.hitPose = false;
|
||||
}
|
||||
}),
|
||||
new BeatAction.Action(beat + 3f + newspaperBeats, delegate
|
||||
{
|
||||
Ringside.instance.blackVoid.color = new Color(1f, 1f, 1f, 0);
|
||||
Ringside.instance.newspaper.SetActive(false);
|
||||
Jukebox.KillLoop(Ringside.instance.kidsLaugh, 0.25f);
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
Ringside.instance.QueuePose(beat, keepZoomedOut, newspaperBeats);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -665,9 +419,134 @@ namespace HeavenStudio.Games
|
|||
}
|
||||
}
|
||||
|
||||
public void QueuePose(float beat, bool keepZoomedOut, float newspaperBeats)
|
||||
{
|
||||
if (newspaperBeats > 0)
|
||||
{
|
||||
reporterShouldHeart = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
reporterShouldHeart = false;
|
||||
}
|
||||
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(beat, delegate {audienceAnim.DoScaledAnimationAsync("PoseAudience", 0.25f); }),
|
||||
new BeatAction.Action(beat, delegate {wrestlerAnim.DoScaledAnimationAsync("PreparePose", 0.25f); }),
|
||||
new BeatAction.Action(beat, delegate {shouldBop = false; }),
|
||||
new BeatAction.Action(beat + 1, delegate { PoseCheck(beat); }),
|
||||
new BeatAction.Action(beat + 3.99f, delegate { wrestlerAnim.Play("Idle", 0, 0); }),
|
||||
new BeatAction.Action(beat + 3.99f, delegate { reporterAnim.Play("IdleReporter", 0, 0); }),
|
||||
new BeatAction.Action(beat + 3.99f, delegate { shouldNotInput = false; }),
|
||||
new BeatAction.Action(beat + 3.99f, delegate { shouldBop = true; }),
|
||||
});
|
||||
if (!keepZoomedOut)
|
||||
{
|
||||
if (newspaperBeats > 0)
|
||||
{
|
||||
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(beat + 3f, delegate
|
||||
{
|
||||
keepZoomOut = true;
|
||||
blackVoid.color = Color.black;
|
||||
newspaper.SetActive(true);
|
||||
if (UnityEngine.Random.Range(1, 3) == 1)
|
||||
{
|
||||
newspaper.GetComponent<Animator>().Play("NewspaperEnter", 0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
newspaper.GetComponent<Animator>().Play("NewspaperEnterRight", 0, 0);
|
||||
}
|
||||
if (!hitPose)
|
||||
{
|
||||
wrestlerNewspaperAnim.Play($"Miss{UnityEngine.Random.Range(1, 7)}Newspaper", 0, 0);
|
||||
reporterNewspaperAnim.Play("IdleReporterNewspaper", 0, 0);
|
||||
kidsLaugh = Jukebox.PlayOneShotGame("ringside/kidslaugh", -1, 1, 1, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
wrestlerNewspaperAnim.Play($"Pose{currentPose}Newspaper", 0, 0);
|
||||
reporterNewspaperAnim.Play("HeartReporterNewspaper", 0, 0);
|
||||
hitPose = true;
|
||||
}
|
||||
}),
|
||||
new BeatAction.Action(beat + 3f + newspaperBeats, delegate
|
||||
{
|
||||
blackVoid.color = new Color(1f, 1f, 1f, 0);
|
||||
newspaper.SetActive(false);
|
||||
lastCamPos = new Vector3(0, 0, -10);
|
||||
Jukebox.KillLoop(kidsLaugh, 0.25f);
|
||||
keepZoomOut = false;
|
||||
})
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(beat + 3.99f, delegate
|
||||
{
|
||||
lastCamPos = new Vector3(0, 0, -10);
|
||||
keepZoomOut = false;
|
||||
}),
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(beat + 2.5f, delegate
|
||||
{
|
||||
lastCamPos = currentCamPos;
|
||||
keepZoomOut = true;
|
||||
})
|
||||
});
|
||||
if (newspaperBeats > 0)
|
||||
{
|
||||
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(beat + 3f, delegate
|
||||
{
|
||||
blackVoid.color = Color.black;
|
||||
newspaper.SetActive(true);
|
||||
if (UnityEngine.Random.Range(1, 3) == 1)
|
||||
{
|
||||
newspaper.GetComponent<Animator>().Play("NewspaperEnter", 0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
newspaper.GetComponent<Animator>().Play("NewspaperEnterRight", 0, 0);
|
||||
}
|
||||
if (!hitPose)
|
||||
{
|
||||
wrestlerNewspaperAnim.Play($"Miss{UnityEngine.Random.Range(1, 7)}Newspaper", 0, 0);
|
||||
reporterNewspaperAnim.Play("IdleReporterNewspaper", 0, 0);
|
||||
kidsLaugh = Jukebox.PlayOneShotGame("ringside/kidslaugh", -1, 1, 1, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
wrestlerNewspaperAnim.Play($"Pose{currentPose}Newspaper", 0, 0);
|
||||
reporterNewspaperAnim.Play("HeartReporterNewspaper", 0, 0);
|
||||
hitPose = true;
|
||||
}
|
||||
}),
|
||||
new BeatAction.Action(beat + 3f + newspaperBeats, delegate
|
||||
{
|
||||
blackVoid.color = new Color(1f, 1f, 1f, 0);
|
||||
newspaper.SetActive(false);
|
||||
Jukebox.KillLoop(kidsLaugh, 0.25f);
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateCameraZoom()
|
||||
{
|
||||
|
||||
if (currentZoomIndex < allCameraEvents.Count && currentZoomIndex >= 0)
|
||||
{
|
||||
currentZoomCamBeat = allCameraEvents[currentZoomIndex].beat;
|
||||
|
|
Loading…
Reference in a new issue