bug fix and huh choice

This commit is contained in:
Rapandrasmus 2024-02-04 20:59:24 +01:00
parent 83d1325b30
commit e7df4bc7c1
2 changed files with 48 additions and 12 deletions

View file

@ -21,6 +21,7 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack
private LBJBear _bear; private LBJBear _bear;
private LumBEARjack.SmallType _type; private LumBEARjack.SmallType _type;
private LumBEARjack.HuhChoice _huh;
private double _rotationBeat; private double _rotationBeat;
private double _rotationLength; private double _rotationLength;
@ -33,10 +34,11 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack
_broom.SetActive(false); _broom.SetActive(false);
} }
public void Init(LBJBear bear, double beat, double length, LumBEARjack.SmallType type, double startUpBeat = -1) public void Init(LBJBear bear, double beat, double length, LumBEARjack.SmallType type, LumBEARjack.HuhChoice huh, double startUpBeat = -1)
{ {
_bear = bear; _bear = bear;
_type = type; _type = type;
_huh = huh;
switch (type) switch (type)
{ {
@ -93,8 +95,22 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack
}; };
SoundByte.PlayOneShotGame("lumbearjack/" + cutSound); SoundByte.PlayOneShotGame("lumbearjack/" + cutSound);
if (_type != LumBEARjack.SmallType.log) SoundByte.PlayOneShotGame("lumbearjack/huh", caller.startBeat + caller.timer + 1); // Add proper logic for direction
_bear.Cut(caller.startBeat + caller.timer, _type != LumBEARjack.SmallType.log, false); // Add proper logic for direction
switch (_huh)
{
case LumBEARjack.HuhChoice.ObjectSpecific:
if (_type != LumBEARjack.SmallType.log) SoundByte.PlayOneShotGame("lumbearjack/huh", caller.startBeat + caller.timer + 1);
_bear.Cut(caller.startBeat + caller.timer, _type != LumBEARjack.SmallType.log, false);
break;
case LumBEARjack.HuhChoice.On:
SoundByte.PlayOneShotGame("lumbearjack/huh", caller.startBeat + caller.timer + 1);
_bear.Cut(caller.startBeat + caller.timer, true, false);
break;
default:
_bear.Cut(caller.startBeat + caller.timer, false, false);
break;
}
Destroy(gameObject); Destroy(gameObject);
} }

View file

@ -45,13 +45,14 @@ namespace HeavenStudio.Games.Loaders
function = delegate function = delegate
{ {
var e = eventCaller.currentEntity; var e = eventCaller.currentEntity;
LumBEARjack.instance.SpawnSmallObject(e.beat, e.length, (LumBEARjack.SmallType)e["type"]); LumBEARjack.instance.SpawnSmallObject(e.beat, e.length, (LumBEARjack.SmallType)e["type"], (LumBEARjack.HuhChoice)e["huh"]);
}, },
defaultLength = 3, defaultLength = 3,
parameters = new() parameters = new()
{ {
new("type", LumBEARjack.SmallType.log, "Type"), new("type", LumBEARjack.SmallType.log, "Type"),
new("sound", true, "Cue Sound") new("sound", true, "Cue Sound"),
new("huh", LumBEARjack.HuhChoice.ObjectSpecific, "Huh")
} }
}, },
new("big", "Big Object") new("big", "Big Object")
@ -122,13 +123,14 @@ namespace HeavenStudio.Games.Loaders
function = delegate function = delegate
{ {
var e = eventCaller.currentEntity; var e = eventCaller.currentEntity;
LumBEARjack.instance.SpawnSmallObject(e.beat, e.length, (LumBEARjack.SmallType)e["type"]); LumBEARjack.instance.SpawnSmallObject(e.beat, e.length, (LumBEARjack.SmallType)e["type"], (LumBEARjack.HuhChoice)e["huh"]);
}, },
defaultLength = 3, defaultLength = 3,
parameters = new() parameters = new()
{ {
new("type", LumBEARjack.SmallType.log, "Type"), new("type", LumBEARjack.SmallType.log, "Type"),
new("sound", true, "Cue Sound") new("sound", true, "Cue Sound"),
new("huh", LumBEARjack.HuhChoice.ObjectSpecific, "Huh")
}, },
resizable = true resizable = true
}, },
@ -214,6 +216,13 @@ namespace HeavenStudio.Games
None = 3 None = 3
} }
public enum HuhChoice
{
ObjectSpecific,
Off,
On
}
[Header("Components")] [Header("Components")]
[SerializeField] private LBJBear _bear; [SerializeField] private LBJBear _bear;
[SerializeField] private LBJSmallObject _smallObjectPrefab; [SerializeField] private LBJSmallObject _smallObjectPrefab;
@ -254,14 +263,14 @@ namespace HeavenStudio.Games
#region Spawn Objects #region Spawn Objects
public void SpawnSmallObject(double beat, double length, SmallType type, double startUpBeat = -1) public void SpawnSmallObject(double beat, double length, SmallType type, HuhChoice huh, double startUpBeat = -1)
{ {
BeatAction.New(this, new() BeatAction.New(this, new()
{ {
new(beat + (length / 3), delegate new(beat + (length / 3), delegate
{ {
LBJSmallObject spawnedObject = Instantiate(_smallObjectPrefab, _cutObjectHolder); LBJSmallObject spawnedObject = Instantiate(_smallObjectPrefab, _cutObjectHolder);
spawnedObject.Init(_bear, beat, length, type, startUpBeat); spawnedObject.Init(_bear, beat, length, type, huh, startUpBeat);
}) })
}); });
} }
@ -321,7 +330,7 @@ namespace HeavenStudio.Games
case "small": case "small":
case "smallS": case "smallS":
SmallObjectSound(e.beat, e.length, (SmallType)e["type"], beat); SmallObjectSound(e.beat, e.length, (SmallType)e["type"], beat);
SpawnSmallObject(e.beat, e.length, (SmallType)e["type"], beat); SpawnSmallObject(e.beat, e.length, (SmallType)e["type"], (HuhChoice)e["huh"], beat);
break; break;
case "big": case "big":
case "bigS": case "bigS":
@ -350,7 +359,7 @@ namespace HeavenStudio.Games
case "small": case "small":
case "smallS": case "smallS":
_bearNoBopBeats.Add(e.beat + (e.length / 3 * 2)); _bearNoBopBeats.Add(e.beat + (e.length / 3 * 2));
if ((SmallType)e["type"] != SmallType.log) if (((SmallType)e["type"] != SmallType.log || (HuhChoice)e["huh"] == HuhChoice.On) && (HuhChoice)e["huh"] != HuhChoice.Off)
{ {
_bearNoBopBeats.Add(e.beat + e.length); _bearNoBopBeats.Add(e.beat + e.length);
_bearNoBopBeats.Add(e.beat + e.length + 1); _bearNoBopBeats.Add(e.beat + e.length + 1);
@ -390,7 +399,18 @@ namespace HeavenStudio.Games
foreach (var e in allEvents) foreach (var e in allEvents)
{ {
if (e.beat + _catAnimationOffsetStart < beat || e.beat < nextGameSwitchBeat) float effectiveLength = e.length / (e.datamodel.Split(1) switch
{
"small" => 3,
"smallS" => 3,
"big" => 4,
"bigS" => 4,
"huge" => 6,
"hugeS" => 6,
_ => 3
});
if ((e.beat + _catAnimationOffsetStart < beat && e.beat + effectiveLength + _catAnimationOffsetEnd > beat) || (e.beat >= beat && e.beat < nextGameSwitchBeat))
{ {
switch (e.datamodel.Split(1)) switch (e.datamodel.Split(1))
{ {