fixed blue bear

This commit is contained in:
Rapandrasmus 2023-12-05 20:12:30 +01:00
parent 4f07d47bdb
commit d35e57249e
3 changed files with 32 additions and 32 deletions

View file

@ -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

View file

@ -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<Param>()
{
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<RiqEntity> _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:

View file

@ -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();