From d35e57249eac83b83a6cb9345de71280f6c5c3a6 Mon Sep 17 00:00:00 2001
From: Rapandrasmus <78219215+Rapandrasmus@users.noreply.github.com>
Date: Tue, 5 Dec 2023 20:12:30 +0100
Subject: [PATCH] fixed blue bear
---
.../BlueBear/Animations/Flashback0Exit.anim | 38 +++++++++----------
Assets/Scripts/Games/BlueBear/BlueBear.cs | 24 ++++++------
Assets/Scripts/Games/BlueBear/Treat.cs | 2 +-
3 files changed, 32 insertions(+), 32 deletions(-)
diff --git a/Assets/Resources/Sprites/Games/BlueBear/Animations/Flashback0Exit.anim b/Assets/Resources/Sprites/Games/BlueBear/Animations/Flashback0Exit.anim
index 8f7c9271f..9d5e67015 100644
--- a/Assets/Resources/Sprites/Games/BlueBear/Animations/Flashback0Exit.anim
+++ b/Assets/Resources/Sprites/Games/BlueBear/Animations/Flashback0Exit.anim
@@ -20,17 +20,17 @@ AnimationClip:
m_Curve:
- serializedVersion: 3
time: 0
- value: {x: 1.258, y: 0.542, z: 0}
- inSlope: {x: -1.4679999, y: -0, z: -0}
- outSlope: {x: 0, y: 0.17200005, z: 0}
+ value: {x: 1.4, y: 0.68, z: 0}
+ inSlope: {x: -1.184, y: -0, z: -0}
+ outSlope: {x: 0, y: 0, z: 0}
tangentMode: 0
weightedMode: 0
inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
- serializedVersion: 3
time: 0.5
- value: {x: 1.258, y: 0.628, z: 0}
- inSlope: {x: -0, y: 0.17200005, z: -0}
+ value: {x: 1.4, y: 0.89, z: 0}
+ inSlope: {x: -0, y: 0.41999996, z: -0}
outSlope: {x: 0, y: 0, z: 0}
tangentMode: 0
weightedMode: 0
@@ -49,8 +49,8 @@ AnimationClip:
time: 0
value: 1
inSlope: 2
- outSlope: -2
- tangentMode: 69
+ outSlope: 0
+ tangentMode: 5
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
@@ -134,16 +134,16 @@ AnimationClip:
m_Curve:
- serializedVersion: 3
time: 0
- value: 1.258
- inSlope: -1.4679999
+ value: 1.4
+ inSlope: -1.184
outSlope: 0
- tangentMode: 69
+ tangentMode: 5
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 0.5
- value: 1.258
+ value: 1.4
inSlope: -0
outSlope: 0
tangentMode: 69
@@ -162,17 +162,17 @@ AnimationClip:
m_Curve:
- serializedVersion: 3
time: 0
- value: 0.542
+ value: 0.68
inSlope: -0
- outSlope: 0.17200005
- tangentMode: 69
+ outSlope: 0
+ tangentMode: 5
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 0.5
- value: 0.628
- inSlope: 0.17200005
+ value: 0.89
+ inSlope: 0.41999996
outSlope: 0
tangentMode: 69
weightedMode: 0
@@ -193,7 +193,7 @@ AnimationClip:
value: 0
inSlope: -0
outSlope: 0
- tangentMode: 69
+ tangentMode: 5
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
@@ -220,8 +220,8 @@ AnimationClip:
time: 0
value: 1
inSlope: 2
- outSlope: -2
- tangentMode: 69
+ outSlope: 0
+ tangentMode: 5
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
diff --git a/Assets/Scripts/Games/BlueBear/BlueBear.cs b/Assets/Scripts/Games/BlueBear/BlueBear.cs
index 64f3d4dad..1294097be 100644
--- a/Assets/Scripts/Games/BlueBear/BlueBear.cs
+++ b/Assets/Scripts/Games/BlueBear/BlueBear.cs
@@ -29,7 +29,7 @@ namespace HeavenStudio.Games.Loaders
},
new GameAction("setEmotion", "Emotion")
{
- function = delegate { var e = eventCaller.currentEntity; BlueBear.instance.SetEmotion(e["type"]); },
+ function = delegate { var e = eventCaller.currentEntity; BlueBear.instance.SetEmotion(e.beat, e["type"]); },
parameters = new List()
{
new Param("type", BlueBear.EmotionType.ClosedEyes, "Emotion", "Which emotion should the blue bear use?")
@@ -274,18 +274,18 @@ namespace HeavenStudio.Games
headAndBodyAnim.SetBool("ShouldOpenMouth", foodHolder.childCount != 0);
if (headAndBodyAnim.GetBool("ShouldOpenMouth"))
{
- _emotionCancelled = true;
+ _emotionCancelledBeat = Conductor.instance.songPositionInBeatsAsDouble;
}
if (PlayerInput.GetIsAction(InputAction_Left) && !IsExpectingInputNow(InputAction_Left.inputLockCategory))
{
SoundByte.PlayOneShotGame("blueBear/whiff", -1, SoundByte.GetPitchFromSemiTones(UnityEngine.Random.Range(-1, 2), false));
- Bite(true);
+ Bite(Conductor.instance.songPositionInBeatsAsDouble, true);
}
else if (PlayerInput.GetIsAction(InputAction_Right) && !IsExpectingInputNow(InputAction_Right.inputLockCategory))
{
SoundByte.PlayOneShotGame("blueBear/whiff", -1, SoundByte.GetPitchFromSemiTones(UnityEngine.Random.Range(-1, 2), false));
- Bite(false);
+ Bite(Conductor.instance.songPositionInBeatsAsDouble, false);
}
UpdateEmotions();
@@ -298,7 +298,7 @@ namespace HeavenStudio.Games
windAnim.SetScaledAnimationSpeed();
}
- private bool _emotionCancelled = false;
+ private double _emotionCancelledBeat = -1;
private int _emotionIndex = 0;
private List _allEmotionsStretch = new();
private EmotionStretchType _lastEmotion = EmotionStretchType.LookUp;
@@ -317,12 +317,11 @@ namespace HeavenStudio.Games
_emotionIndex++;
_lastEmotion = (EmotionStretchType)_allEmotionsStretch[_emotionIndex - 1]["type"];
crying = _lastEmotion == EmotionStretchType.StartCrying;
- _emotionCancelled = false;
UpdateEmotions();
return;
}
- if (beat >= e.beat && beat < e.beat + e.length && !_emotionCancelled)
+ if (beat >= e.beat && beat < e.beat + e.length && !(_emotionCancelledBeat >= e.beat && _emotionCancelledBeat < e.beat + e.length))
{
_lastEmotion = (EmotionStretchType)e["type"];
crying = _lastEmotion == EmotionStretchType.StartCrying;
@@ -388,9 +387,9 @@ namespace HeavenStudio.Games
windAnim.DoScaledAnimationAsync("Wind", 0.5f);
}
- public void Bite(bool left)
+ public void Bite(double beat, bool left)
{
- _emotionCancelled = true;
+ _emotionCancelledBeat = beat;
if (crying)
{
headAndBodyAnim.DoScaledAnimationAsync(left ? "CryBiteL" : "CryBiteR", 0.5f);
@@ -456,14 +455,15 @@ namespace HeavenStudio.Games
}
}
- public void SetEmotion(int emotion)
+ public void SetEmotion(double beat, int emotion)
{
- _emotionCancelled = true;
+ _emotionCancelledBeat = beat;
switch (emotion)
{
case (int)EmotionType.Neutral:
- //check if smiling then play "StopSmile"
headAndBodyAnim.DoScaledAnimationAsync("Idle", 0.5f);
+ if (_allEmotionsStretch.Count == 0 || _lastEmotion != EmotionStretchType.Smile) return;
+ headAndBodyAnim.DoScaledAnimationAsync("StopSmile", 0.5f);
crying = false;
break;
case (int)EmotionType.ClosedEyes:
diff --git a/Assets/Scripts/Games/BlueBear/Treat.cs b/Assets/Scripts/Games/BlueBear/Treat.cs
index 5d5e3f872..c039abde6 100644
--- a/Assets/Scripts/Games/BlueBear/Treat.cs
+++ b/Assets/Scripts/Games/BlueBear/Treat.cs
@@ -68,7 +68,7 @@ namespace HeavenStudio.Games.Scripts_BlueBear
SoundByte.PlayOneShotGame("blueBear/chompDonut");
}
- game.Bite(isCake);
+ game.Bite(Conductor.instance.songPositionInBeatsAsDouble, isCake);
game.EatTreat();
SpawnCrumbs();