blue bear and bop region fix

This commit is contained in:
Rapandrasmus 2023-12-07 20:48:43 +01:00
parent 87653b0d65
commit 7346e17446
2 changed files with 26 additions and 10 deletions

View file

@ -344,14 +344,24 @@ namespace HeavenStudio.Games
if (_allEmotionsStretch.Count == 0) return;
UpdateEmotions();
var allEmosBeforeBeat = EventCaller.GetAllInGameManagerList("blueBear", new string[] { "stretchEmotion" }).FindAll(x => x.beat < beat);
if (allEmosBeforeBeat.Count == 0) return;
if ((EmotionStretchType)allEmosBeforeBeat[^1]["type"] == EmotionStretchType.StartCrying)
var allSetEmosBeforeBeat = EventCaller.GetAllInGameManagerList("blueBear", new string[] { "setEmotion" }).FindAll(x => x.beat < beat);
if (allEmosBeforeBeat.Count != 0)
{
headAndBodyAnim.DoScaledAnimationAsync("CryIdle", 0.5f);
if ((EmotionStretchType)allEmosBeforeBeat[^1]["type"] == EmotionStretchType.StartCrying)
{
headAndBodyAnim.DoScaledAnimationAsync("CryIdle", 0.5f);
}
else if ((EmotionStretchType)allEmosBeforeBeat[^1]["type"] == EmotionStretchType.Smile)
{
headAndBodyAnim.DoScaledAnimationAsync("SmileIdle", 0.5f);
}
}
else if ((EmotionStretchType)allEmosBeforeBeat[^1]["type"] == EmotionStretchType.Smile)
if (allSetEmosBeforeBeat.Count != 0)
{
headAndBodyAnim.DoScaledAnimationAsync("SmileIdle", 0.5f);
EmotionType lastType = (EmotionType)allSetEmosBeforeBeat[^1]["type"];
if (allEmosBeforeBeat.Count > 0 && allSetEmosBeforeBeat[^1].beat >= allEmosBeforeBeat[^1].beat) SetEmotion(beat, (int)lastType, false);
else SetEmotion(beat, (int)lastType);
}
}
@ -455,16 +465,16 @@ namespace HeavenStudio.Games
}
}
public void SetEmotion(double beat, int emotion)
public void SetEmotion(double beat, int emotion, bool ableToStopSmile = true)
{
_emotionCancelledBeat = beat;
switch (emotion)
{
case (int)EmotionType.Neutral:
headAndBodyAnim.DoScaledAnimationAsync("Idle", 0.5f);
if (_allEmotionsStretch.Count == 0 || _lastEmotion != EmotionStretchType.Smile) return;
headAndBodyAnim.DoScaledAnimationAsync("StopSmile", 0.5f);
crying = false;
headAndBodyAnim.DoScaledAnimationAsync("Idle", 0.5f);
if (_allEmotionsStretch.Count == 0 || _lastEmotion != EmotionStretchType.Smile || !ableToStopSmile) return;
headAndBodyAnim.DoScaledAnimationAsync("StopSmile", 0.5f);
break;
case (int)EmotionType.ClosedEyes:
headAndBodyAnim.DoScaledAnimationAsync("EyesClosed", 0.5f);

View file

@ -457,7 +457,7 @@ namespace HeavenStudio.Games
On = 1,
}
private Dictionary<double, int> bopRegion = new();
protected Dictionary<double, int> bopRegion = new();
public bool BeatIsInBopRegion(double beat)
{
@ -488,10 +488,16 @@ namespace HeavenStudio.Games
protected void SetupBopRegion(string gameName, string eventName, string toggleName, bool isBool = true)
{
var allEvents = EventCaller.GetAllInGameManagerList(gameName, new string[] { eventName });
if (allEvents.Count == 0) return;
allEvents.Sort((x, y) => x.beat.CompareTo(y.beat));
foreach (var e in allEvents)
{
if (bopRegion.ContainsKey(e.beat))
{
Debug.Log("Two bops on the same beat, ignoring this one");
continue;
}
if (isBool)
{
bopRegion.Add(e.beat, e[toggleName] ? 1 : 0);