i love the blue bear

This commit is contained in:
Rapandrasmus 2023-12-15 19:07:50 +01:00
parent a72e2a154b
commit f7639c3a4f
3 changed files with 32 additions and 36 deletions

View file

@ -39,16 +39,12 @@ namespace HeavenStudio.Games.Loaders
}, },
new GameAction("stretchEmotion", "Emotion") new GameAction("stretchEmotion", "Emotion")
{ {
function = delegate { var e = eventCaller.currentEntity; if (e["instant"] || e["type"] == (int)BlueBear.EmotionStretchType.NoEmotion) BlueBear.instance.SetEmotion(e.beat, e["type"]); }, function = delegate { var e = eventCaller.currentEntity; if (BlueBear.IsInstantEmotion(e["type"])) BlueBear.instance.SetEmotion(e.beat, e["type"]); },
defaultLength = 4, defaultLength = 4,
resizable = true, resizable = true,
parameters = new List<Param>() parameters = new List<Param>()
{ {
new Param("type", BlueBear.EmotionStretchType.NoEmotion, "Emotion", "Which emotion should the blue bear use?", new() new Param("type", BlueBear.EmotionStretchType.NoEmotion, "Emotion", "Which emotion should the blue bear use?"),
{
new((x, _) => (int)x != (int)BlueBear.EmotionStretchType.NoEmotion, new string[] { "instant" })
}),
new Param("instant", false, "Instant"),
} }
}, },
new GameAction("wind", "Wind") new GameAction("wind", "Wind")
@ -109,7 +105,16 @@ namespace HeavenStudio.Games
LookUp = 0, LookUp = 0,
Smile = 1, Smile = 1,
StartCrying = 2, StartCrying = 2,
ClosedEyes = 3,
SmileInstant = 4,
CryingInstant
} }
public static bool IsInstantEmotion(int emotion)
{
return emotion is (int)EmotionStretchType.NoEmotion or (int)EmotionStretchType.ClosedEyes or (int)EmotionStretchType.SmileInstant or (int)EmotionStretchType.CryingInstant;
}
public enum StoryType public enum StoryType
{ {
Date, Date,
@ -367,8 +372,9 @@ namespace HeavenStudio.Games
private void HandleEmotions(double beat) private void HandleEmotions(double beat)
{ {
_allEmotionsStretch = EventCaller.GetAllInGameManagerList("blueBear", new string[] { "stretchEmotion" }).FindAll(x => !(x["instant"] || x["type"] == (int)EmotionStretchType.NoEmotion)); _allEmotionsStretch = EventCaller.GetAllInGameManagerList("blueBear", new string[] { "stretchEmotion" }).FindAll(x => !IsInstantEmotion(x["type"]));
if (_allEmotionsStretch.Count == 0) return; if (_allEmotionsStretch.Count != 0)
{
UpdateEmotions(); UpdateEmotions();
var allEmosBeforeBeat = _allEmotionsStretch.FindAll(x => x.beat < beat); var allEmosBeforeBeat = _allEmotionsStretch.FindAll(x => x.beat < beat);
if (allEmosBeforeBeat.Count != 0) if (allEmosBeforeBeat.Count != 0)
@ -383,6 +389,11 @@ namespace HeavenStudio.Games
} }
} }
} }
var allSetEmotionsBeforeBeat = EventCaller.GetAllInGameManagerList("blueBear", new string[] { "stretchEmotion" }).FindAll(x => IsInstantEmotion(x["type"]) && x.beat < beat);
if (allSetEmotionsBeforeBeat.Count == 0) return;
var lastEvent = allSetEmotionsBeforeBeat[^1];
SetEmotion(lastEvent.beat, lastEvent["type"]);
}
public override void OnPlay(double beat) public override void OnPlay(double beat)
{ {
@ -497,7 +508,7 @@ namespace HeavenStudio.Games
private bool _wantMouthOpen = false; private bool _wantMouthOpen = false;
public void SetEmotion(double beat, int emotion, bool ableToStopSmile = true) public void SetEmotion(double beat, int emotion)
{ {
_emotionCancelledBeat = beat; _emotionCancelledBeat = beat;
_wantMouthOpen = false; _wantMouthOpen = false;
@ -507,14 +518,14 @@ namespace HeavenStudio.Games
case (int)EmotionStretchType.NoEmotion: case (int)EmotionStretchType.NoEmotion:
headAndBodyAnim.DoScaledAnimationAsync("Idle", 0.5f); headAndBodyAnim.DoScaledAnimationAsync("Idle", 0.5f);
break; break;
case (int)EmotionStretchType.LookUp: case (int)EmotionStretchType.ClosedEyes:
headAndBodyAnim.DoScaledAnimationAsync("EyesClosed", 0.5f); headAndBodyAnim.DoScaledAnimationAsync("EyesClosed", 0.5f);
break; break;
case (int)EmotionStretchType.StartCrying: case (int)EmotionStretchType.CryingInstant:
headAndBodyAnim.DoScaledAnimationAsync("CryIdle", 0.5f); headAndBodyAnim.DoScaledAnimationAsync("CryIdle", 0.5f);
crying = true; crying = true;
break; break;
case (int)EmotionStretchType.Smile: case (int)EmotionStretchType.SmileInstant:
headAndBodyAnim.DoScaledAnimationAsync("SmileIdle", 0.5f); headAndBodyAnim.DoScaledAnimationAsync("SmileIdle", 0.5f);
break; break;
default: default:

View file

@ -1,15 +1,7 @@
using HeavenStudio.Util; using HeavenStudio.Util;
using HeavenStudio.Common; using HeavenStudio.Common;
using JetBrains.Annotations;
using Starpelly.Transformer;
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using UnityEngine; using UnityEngine;
using UnityEngine.Rendering;
using static HeavenStudio.EntityTypes;
using Jukebox; using Jukebox;
namespace HeavenStudio.Games.Loaders namespace HeavenStudio.Games.Loaders

View file

@ -1,13 +1,6 @@
using HeavenStudio.Util; using HeavenStudio.Util;
using JetBrains.Annotations;
using Starpelly.Transformer;
using System;
using System.Linq;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using UnityEngine; using UnityEngine;
using UnityEngine.Rendering;
using static HeavenStudio.EntityTypes;
namespace HeavenStudio.Games.Scripts_LaunchParty namespace HeavenStudio.Games.Scripts_LaunchParty
{ {