rest visuals implemented

This commit is contained in:
Rapandrasmus 2024-02-04 15:19:56 +01:00
parent b8a844530f
commit 7f608e32d1
3 changed files with 42 additions and 5 deletions

View file

@ -3329,4 +3329,11 @@ AnimationClip:
script: {fileID: 0}
m_HasGenericRootTransform: 0
m_HasMotionFloatCurves: 0
m_Events: []
m_Events:
- time: 1.2666667
functionName: RestSound
data:
objectReferenceParameter: {fileID: 0}
floatParameter: 0
intParameter: 0
messageOptions: 0

View file

@ -10,9 +10,12 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack
[Header("Components")]
[SerializeField] private Animator _anim;
private bool _rested = false;
private bool _restSound = true;
public void SwingWhiff(bool sound = true, bool force = false)
{
if (_anim.IsPlayingAnimationNames("BeastWhiff", "BeastCut", "BeastCutMid", "BeastHalfCut") && !force) return;
if ((_anim.IsPlayingAnimationNames("BeastWhiff", "BeastCut", "BeastCutMid", "BeastHalfCut", "BeastRest") || _rested) && !force) return;
if (sound) SoundByte.PlayOneShotGame("lumbearjack/swing", -1, SoundByte.GetPitchFromCents(Random.Range(-200, 201), false));
_anim.DoScaledAnimationAsync("BeastWhiff", 0.5f);
}
@ -37,9 +40,20 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack
public void Bop()
{
if (_anim.IsPlayingAnimationNames("BeastWhiff")) return;
if (_anim.IsPlayingAnimationNames("BeastWhiff", "BeastRest") || _rested) return;
_anim.DoScaledAnimationAsync("BeastBop", 0.5f);
}
public void Rest(bool instant, bool sound)
{
_anim.DoScaledAnimationAsync("BeastRest", 0.5f, instant ? 1 : 0);
_rested = true;
}
public void RestSound()
{
if (_restSound) SoundByte.PlayOneShotGame("lumbearjack/sigh" + (Random.Range(1, 3) == 1 ? "A" : "B"));
}
}
}

View file

@ -96,9 +96,16 @@ namespace HeavenStudio.Games.Loaders
},
new("sigh", "Rest")
{
preFunction = delegate
function = delegate
{
SoundByte.PlayOneShotGame("lumbearjack/sigh" + (UnityEngine.Random.Range(1, 3) == 1 ? "A" : "B"), eventCaller.currentEntity.beat, 1, 1, false, true);
var e = eventCaller.currentEntity;
LumBEARjack.instance.RestBear(e["instant"], e["sound"]);
},
defaultLength = 4,
parameters = new()
{
new("instant", false, "Instant"),
new("sound", true, "Sound")
}
},
@ -484,5 +491,14 @@ namespace HeavenStudio.Games
}
#endregion
#region Misc
public void RestBear(bool instant, bool sound)
{
_bear.Rest(instant, sound);
}
#endregion
}
}