left cat put

This commit is contained in:
Rapandrasmus 2024-02-08 19:41:05 +01:00
parent fc32e0ae08
commit 844df979a1
5 changed files with 356 additions and 58 deletions

View file

@ -296,7 +296,7 @@ Transform:
- {fileID: 6382023476871671071} - {fileID: 6382023476871671071}
- {fileID: 6928018856485179324} - {fileID: 6928018856485179324}
m_Father: {fileID: 2298792418077467027} m_Father: {fileID: 2298792418077467027}
m_RootOrder: 4 m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!95 &6525566897441854329 --- !u!95 &6525566897441854329
Animator: Animator:
@ -773,6 +773,7 @@ Transform:
- {fileID: 3867080228037786540} - {fileID: 3867080228037786540}
- {fileID: 5426823713711891276} - {fileID: 5426823713711891276}
- {fileID: 8968276012044984537} - {fileID: 8968276012044984537}
- {fileID: 6081244242579349435}
- {fileID: 1786682412932371778} - {fileID: 1786682412932371778}
- {fileID: 615325631333663386} - {fileID: 615325631333663386}
m_Father: {fileID: 0} m_Father: {fileID: 0}
@ -809,6 +810,18 @@ MonoBehaviour:
- {fileID: 7195153636254270523} - {fileID: 7195153636254270523}
- {fileID: 8599624938353215766} - {fileID: 8599624938353215766}
- {fileID: 4673486003957519203} - {fileID: 4673486003957519203}
_catLeft: {fileID: 3984350684958007215}
_catLeftObjectsSmall:
- {fileID: 6041809295034117955}
- {fileID: 6549654297430473285}
- {fileID: 7892457053171669245}
- {fileID: 3837707130267555365}
_catLeftObjectsBig:
- {fileID: 8612418700374271145}
_catLeftObjectsHuge:
- {fileID: 5461475411022461785}
- {fileID: 6866122181738215028}
- {fileID: 7551078816062909441}
_catAnimationOffsetStart: -0.5 _catAnimationOffsetStart: -0.5
_catAnimationOffsetEnd: 0.5 _catAnimationOffsetEnd: 0.5
--- !u!1 &3527631078867808426 --- !u!1 &3527631078867808426
@ -1683,7 +1696,7 @@ Transform:
m_Children: m_Children:
- {fileID: 3909255085184453611} - {fileID: 3909255085184453611}
m_Father: {fileID: 2298792418077467027} m_Father: {fileID: 2298792418077467027}
m_RootOrder: 5 m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &2822577256614703768 --- !u!212 &2822577256614703768
SpriteRenderer: SpriteRenderer:
@ -2688,6 +2701,153 @@ Transform:
m_Father: {fileID: 8003342604478868877} m_Father: {fileID: 8003342604478868877}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &839973794089554723
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 2298792418077467027}
m_Modifications:
- target: {fileID: 704268889839616480, guid: e2e08f4bea037a14da41e5490ce6d393, type: 3}
propertyPath: m_FlipX
value: 1
objectReference: {fileID: 0}
- target: {fileID: 975253968622856459, guid: e2e08f4bea037a14da41e5490ce6d393, type: 3}
propertyPath: m_Materials.Array.data[0]
value:
objectReference: {fileID: 2100000, guid: 80a3377bf2a9b4f4289c3d4015492887, type: 2}
- target: {fileID: 3826053839341317980, guid: e2e08f4bea037a14da41e5490ce6d393, type: 3}
propertyPath: m_FlipX
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4123127066797828317, guid: e2e08f4bea037a14da41e5490ce6d393, type: 3}
propertyPath: m_FlipX
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4790720146603136875, guid: e2e08f4bea037a14da41e5490ce6d393, type: 3}
propertyPath: m_FlipX
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5550656414377755604, guid: e2e08f4bea037a14da41e5490ce6d393, type: 3}
propertyPath: m_FlipX
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6603100556211832873, guid: e2e08f4bea037a14da41e5490ce6d393, type: 3}
propertyPath: m_FlipX
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6903108778393898136, guid: e2e08f4bea037a14da41e5490ce6d393, type: 3}
propertyPath: m_RootOrder
value: 4
objectReference: {fileID: 0}
- target: {fileID: 6903108778393898136, guid: e2e08f4bea037a14da41e5490ce6d393, type: 3}
propertyPath: m_LocalScale.x
value: -1
objectReference: {fileID: 0}
- target: {fileID: 6903108778393898136, guid: e2e08f4bea037a14da41e5490ce6d393, type: 3}
propertyPath: m_LocalPosition.x
value: -4.16
objectReference: {fileID: 0}
- target: {fileID: 6903108778393898136, guid: e2e08f4bea037a14da41e5490ce6d393, type: 3}
propertyPath: m_LocalPosition.y
value: -1.31
objectReference: {fileID: 0}
- target: {fileID: 6903108778393898136, guid: e2e08f4bea037a14da41e5490ce6d393, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6903108778393898136, guid: e2e08f4bea037a14da41e5490ce6d393, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6903108778393898136, guid: e2e08f4bea037a14da41e5490ce6d393, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6903108778393898136, guid: e2e08f4bea037a14da41e5490ce6d393, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6903108778393898136, guid: e2e08f4bea037a14da41e5490ce6d393, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6903108778393898136, guid: e2e08f4bea037a14da41e5490ce6d393, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6903108778393898136, guid: e2e08f4bea037a14da41e5490ce6d393, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6903108778393898136, guid: e2e08f4bea037a14da41e5490ce6d393, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7537329938738626932, guid: e2e08f4bea037a14da41e5490ce6d393, type: 3}
propertyPath: m_Name
value: CatLeft
objectReference: {fileID: 0}
- target: {fileID: 7991420802792855905, guid: e2e08f4bea037a14da41e5490ce6d393, type: 3}
propertyPath: m_FlipX
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8843339730488359881, guid: e2e08f4bea037a14da41e5490ce6d393, type: 3}
propertyPath: m_FlipX
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: e2e08f4bea037a14da41e5490ce6d393, type: 3}
--- !u!1 &3837707130267555365 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 4533552499156354310, guid: e2e08f4bea037a14da41e5490ce6d393, type: 3}
m_PrefabInstance: {fileID: 839973794089554723}
m_PrefabAsset: {fileID: 0}
--- !u!95 &3984350684958007215 stripped
Animator:
m_CorrespondingSourceObject: {fileID: 4387471827645615244, guid: e2e08f4bea037a14da41e5490ce6d393, type: 3}
m_PrefabInstance: {fileID: 839973794089554723}
m_PrefabAsset: {fileID: 0}
--- !u!1 &5461475411022461785 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 4639588617581127802, guid: e2e08f4bea037a14da41e5490ce6d393, type: 3}
m_PrefabInstance: {fileID: 839973794089554723}
m_PrefabAsset: {fileID: 0}
--- !u!1 &6041809295034117955 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 6372873014407674976, guid: e2e08f4bea037a14da41e5490ce6d393, type: 3}
m_PrefabInstance: {fileID: 839973794089554723}
m_PrefabAsset: {fileID: 0}
--- !u!4 &6081244242579349435 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 6903108778393898136, guid: e2e08f4bea037a14da41e5490ce6d393, type: 3}
m_PrefabInstance: {fileID: 839973794089554723}
m_PrefabAsset: {fileID: 0}
--- !u!1 &6549654297430473285 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 5858378645934729574, guid: e2e08f4bea037a14da41e5490ce6d393, type: 3}
m_PrefabInstance: {fileID: 839973794089554723}
m_PrefabAsset: {fileID: 0}
--- !u!1 &6866122181738215028 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 6116295155612378455, guid: e2e08f4bea037a14da41e5490ce6d393, type: 3}
m_PrefabInstance: {fileID: 839973794089554723}
m_PrefabAsset: {fileID: 0}
--- !u!1 &7551078816062909441 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 7161565195996790562, guid: e2e08f4bea037a14da41e5490ce6d393, type: 3}
m_PrefabInstance: {fileID: 839973794089554723}
m_PrefabAsset: {fileID: 0}
--- !u!1 &7892457053171669245 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 7363258296528702430, guid: e2e08f4bea037a14da41e5490ce6d393, type: 3}
m_PrefabInstance: {fileID: 839973794089554723}
m_PrefabAsset: {fileID: 0}
--- !u!1 &8612418700374271145 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 8947907653433374602, guid: e2e08f4bea037a14da41e5490ce6d393, type: 3}
m_PrefabInstance: {fileID: 839973794089554723}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &2574215485148474433 --- !u!1001 &2574215485148474433
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -2711,6 +2871,10 @@ PrefabInstance:
propertyPath: m_Materials.Array.data[0] propertyPath: m_Materials.Array.data[0]
value: value:
objectReference: {fileID: 2100000, guid: 80a3377bf2a9b4f4289c3d4015492887, type: 2} objectReference: {fileID: 2100000, guid: 80a3377bf2a9b4f4289c3d4015492887, type: 2}
- target: {fileID: 4639588617581127802, guid: e2e08f4bea037a14da41e5490ce6d393, type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5729554252018073476, guid: e2e08f4bea037a14da41e5490ce6d393, type: 3} - target: {fileID: 5729554252018073476, guid: e2e08f4bea037a14da41e5490ce6d393, type: 3}
propertyPath: m_FlipY propertyPath: m_FlipY
value: 1 value: 1

View file

@ -18,15 +18,18 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack
private LBJBear _bear; private LBJBear _bear;
private LumBEARjack.BigType _type; private LumBEARjack.BigType _type;
private bool _right = true;
private PlayerActionEvent _cutActionEvent; private PlayerActionEvent _cutActionEvent;
private double _rotationBeat; private double _rotationBeat;
private double _rotationLength; private double _rotationLength;
public void Init(LBJBear bear, double beat, double length, LumBEARjack.BigType type, double startUpBeat = -1) public void Init(LBJBear bear, double beat, double length, LumBEARjack.BigType type, bool right, double startUpBeat = -1)
{ {
_bear = bear; _bear = bear;
_type = type; _type = type;
_right = right;
_rotationBeat = beat + (length / 4 * 2); _rotationBeat = beat + (length / 4 * 2);
_rotationLength = length / 4; _rotationLength = length / 4;
@ -47,7 +50,7 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack
var func = EasingFunction.GetEasingFunction(_ease); var func = EasingFunction.GetEasingFunction(_ease);
float newRotation = func(_rotationStart, _rotationEnd, normalized); float newRotation = func(_rotationStart, _rotationEnd, normalized);
transform.localEulerAngles = new Vector3(0, 0, newRotation); transform.localEulerAngles = new Vector3(0, 0, newRotation * (_right ? 1 : -1));
} }
private void JustHit(PlayerActionEvent caller, float state) private void JustHit(PlayerActionEvent caller, float state)

View file

@ -2,6 +2,7 @@ using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using HeavenStudio.Util; using HeavenStudio.Util;
using static HeavenStudio.Games.Scripts_AirRally.Cloud;
namespace HeavenStudio.Games.Scripts_LumBEARjack namespace HeavenStudio.Games.Scripts_LumBEARjack
{ {
@ -22,6 +23,8 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack
private LBJBear _bear; private LBJBear _bear;
private LumBEARjack.HugeType _type; private LumBEARjack.HugeType _type;
private bool _right = true;
private PlayerActionEvent[] _soundsToDeleteIfMiss = new PlayerActionEvent[3]; private PlayerActionEvent[] _soundsToDeleteIfMiss = new PlayerActionEvent[3];
private double _rotationBeat; private double _rotationBeat;
@ -34,10 +37,11 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack
_peachSR.gameObject.SetActive(false); _peachSR.gameObject.SetActive(false);
} }
public void Init(LBJBear bear, double beat, double length, LumBEARjack.HugeType type, double startUpBeat = -1) public void Init(LBJBear bear, double beat, double length, LumBEARjack.HugeType type, bool right, double startUpBeat = -1)
{ {
_bear = bear; _bear = bear;
_type = type; _type = type;
_right = right;
switch (type) switch (type)
{ {
@ -89,7 +93,7 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack
var func = EasingFunction.GetEasingFunction(_ease); var func = EasingFunction.GetEasingFunction(_ease);
float newRotation = func(_rotationStart, _rotationEnd, normalized); float newRotation = func(_rotationStart, _rotationEnd, normalized);
transform.localEulerAngles = new Vector3(0, 0, newRotation); transform.localEulerAngles = new Vector3(0, 0, newRotation * (_right ? 1 : -1));
} }
private void SetObjectCutSprite(int step) private void SetObjectCutSprite(int step)

View file

@ -22,6 +22,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 LumBEARjack.HuhChoice _huh;
private bool _right = true;
private double _rotationBeat; private double _rotationBeat;
private double _rotationLength; private double _rotationLength;
@ -34,11 +35,12 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack
_broom.SetActive(false); _broom.SetActive(false);
} }
public void Init(LBJBear bear, double beat, double length, LumBEARjack.SmallType type, LumBEARjack.HuhChoice huh, double startUpBeat = -1) public void Init(LBJBear bear, double beat, double length, LumBEARjack.SmallType type, LumBEARjack.HuhChoice huh, bool right, double startUpBeat = -1)
{ {
_bear = bear; _bear = bear;
_type = type; _type = type;
_huh = huh; _huh = huh;
_right = right;
switch (type) switch (type)
{ {
@ -71,7 +73,7 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack
var func = EasingFunction.GetEasingFunction(_ease); var func = EasingFunction.GetEasingFunction(_ease);
float newRotation = func(_rotationStart, _rotationEnd, normalized); float newRotation = func(_rotationStart, _rotationEnd, normalized);
transform.localEulerAngles = new Vector3(0, 0, newRotation); transform.localEulerAngles = new Vector3(0, 0, newRotation * (_right ? 1 : -1));
} }
private void Just(PlayerActionEvent caller, float state) private void Just(PlayerActionEvent caller, float state)
@ -95,13 +97,11 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack
}; };
SoundByte.PlayOneShotGame("lumbearjack/" + cutSound); SoundByte.PlayOneShotGame("lumbearjack/" + cutSound);
// Add proper logic for direction
switch (_huh) switch (_huh)
{ {
case LumBEARjack.HuhChoice.ObjectSpecific: case LumBEARjack.HuhChoice.ObjectSpecific:
if (_type != LumBEARjack.SmallType.log) SoundByte.PlayOneShotGame("lumbearjack/huh", caller.startBeat + caller.timer + 1); 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); _bear.Cut(caller.startBeat + caller.timer, _type != LumBEARjack.SmallType.log, !_right);
break; break;
case LumBEARjack.HuhChoice.On: case LumBEARjack.HuhChoice.On:
SoundByte.PlayOneShotGame("lumbearjack/huh", caller.startBeat + caller.timer + 1); SoundByte.PlayOneShotGame("lumbearjack/huh", caller.startBeat + caller.timer + 1);

View file

@ -45,14 +45,15 @@ 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.HuhChoice)e["huh"]); LumBEARjack.instance.SpawnSmallObject(e.beat, e.length, (LumBEARjack.SmallType)e["type"], (LumBEARjack.HuhChoice)e["huh"], (LumBEARjack.CatPutChoice)e["cat"]);
}, },
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("huh", LumBEARjack.HuhChoice.ObjectSpecific, "Huh"),
new("cat", LumBEARjack.CatPutChoice.Alternate, "Side")
} }
}, },
new("big", "Big Object") new("big", "Big Object")
@ -66,13 +67,14 @@ namespace HeavenStudio.Games.Loaders
function = delegate function = delegate
{ {
var e = eventCaller.currentEntity; var e = eventCaller.currentEntity;
LumBEARjack.instance.SpawnBigObject(e.beat, e.length, (LumBEARjack.BigType)e["type"]); LumBEARjack.instance.SpawnBigObject(e.beat, e.length, (LumBEARjack.BigType)e["type"], (LumBEARjack.CatPutChoice)e["cat"]);
}, },
defaultLength = 4, defaultLength = 4,
parameters = new() parameters = new()
{ {
new("type", LumBEARjack.BigType.log, "Type"), new("type", LumBEARjack.BigType.log, "Type"),
new("sound", true, "Cue Sound") new("sound", true, "Cue Sound"),
new("cat", LumBEARjack.CatPutChoice.Alternate, "Side")
} }
}, },
new("huge", "Huge Object") new("huge", "Huge Object")
@ -86,13 +88,22 @@ namespace HeavenStudio.Games.Loaders
function = delegate function = delegate
{ {
var e = eventCaller.currentEntity; var e = eventCaller.currentEntity;
LumBEARjack.instance.SpawnHugeObject(e.beat, e.length, (LumBEARjack.HugeType)e["type"]); LumBEARjack.instance.SpawnHugeObject(e.beat, e.length, (LumBEARjack.HugeType)e["type"], (LumBEARjack.CatPutChoice)e["cat"]);
}, },
defaultLength = 6, defaultLength = 6,
parameters = new() parameters = new()
{ {
new("type", LumBEARjack.HugeType.log, "Type"), new("type", LumBEARjack.HugeType.log, "Type"),
new("sound", true, "Cue Sound") new("sound", true, "Cue Sound"),
new("cat", LumBEARjack.CatPutChoice.Alternate, "Side")
}
},
new("cats", "Cats Presence")
{
defaultLength = 0.5f,
parameters = new()
{
new("main", LumBEARjack.MainCatChoice.Right, "Main Cats")
} }
}, },
new("sigh", "Rest") new("sigh", "Rest")
@ -123,14 +134,15 @@ 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.HuhChoice)e["huh"]); LumBEARjack.instance.SpawnSmallObject(e.beat, e.length, (LumBEARjack.SmallType)e["type"], (LumBEARjack.HuhChoice)e["huh"], (LumBEARjack.CatPutChoice)e["cat"]);
}, },
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("huh", LumBEARjack.HuhChoice.ObjectSpecific, "Huh"),
new("cat", LumBEARjack.CatPutChoice.Alternate, "Side")
}, },
resizable = true resizable = true
}, },
@ -145,13 +157,14 @@ namespace HeavenStudio.Games.Loaders
function = delegate function = delegate
{ {
var e = eventCaller.currentEntity; var e = eventCaller.currentEntity;
LumBEARjack.instance.SpawnBigObject(e.beat, e.length, (LumBEARjack.BigType)e["type"]); LumBEARjack.instance.SpawnBigObject(e.beat, e.length, (LumBEARjack.BigType)e["type"], (LumBEARjack.CatPutChoice)e["cat"]);
}, },
defaultLength = 4, defaultLength = 4,
parameters = new() parameters = new()
{ {
new("type", LumBEARjack.BigType.log, "Type"), new("type", LumBEARjack.BigType.log, "Type"),
new("sound", true, "Cue Sound") new("sound", true, "Cue Sound"),
new("cat", LumBEARjack.CatPutChoice.Alternate, "Side")
}, },
resizable = true resizable = true
}, },
@ -166,13 +179,14 @@ namespace HeavenStudio.Games.Loaders
function = delegate function = delegate
{ {
var e = eventCaller.currentEntity; var e = eventCaller.currentEntity;
LumBEARjack.instance.SpawnHugeObject(e.beat, e.length, (LumBEARjack.HugeType)e["type"]); LumBEARjack.instance.SpawnHugeObject(e.beat, e.length, (LumBEARjack.HugeType)e["type"], (LumBEARjack.CatPutChoice)e["cat"]);
}, },
defaultLength = 6, defaultLength = 6,
parameters = new() parameters = new()
{ {
new("type", LumBEARjack.HugeType.log, "Type"), new("type", LumBEARjack.HugeType.log, "Type"),
new("sound", true, "Cue Sound") new("sound", true, "Cue Sound"),
new("cat", LumBEARjack.CatPutChoice.Alternate, "Side")
}, },
resizable = true resizable = true
}, },
@ -223,22 +237,43 @@ namespace HeavenStudio.Games
On On
} }
public enum CatPutChoice
{
Alternate,
Right,
Left
}
public enum MainCatChoice
{
Right,
Left,
Both
}
[Header("Components")] [Header("Components")]
[SerializeField] private LBJBear _bear; [SerializeField] private LBJBear _bear;
[SerializeField] private LBJSmallObject _smallObjectPrefab; [SerializeField] private LBJSmallObject _smallObjectPrefab;
[SerializeField] private LBJBigObject _bigObjectPrefab; [SerializeField] private LBJBigObject _bigObjectPrefab;
[SerializeField] private LBJHugeObject _hugeObjectPrefab; [SerializeField] private LBJHugeObject _hugeObjectPrefab;
[SerializeField] private Transform _cutObjectHolder; [SerializeField] private Transform _cutObjectHolder;
[SerializeField] private Animator _catRight; [SerializeField] private Animator _catRight;
[SerializeField] private GameObject[] _catRightObjectsSmall = new GameObject[4]; [SerializeField] private GameObject[] _catRightObjectsSmall = new GameObject[4];
[SerializeField] private GameObject[] _catRightObjectsBig = new GameObject[1]; [SerializeField] private GameObject[] _catRightObjectsBig = new GameObject[1];
[SerializeField] private GameObject[] _catRightObjectsHuge = new GameObject[3]; [SerializeField] private GameObject[] _catRightObjectsHuge = new GameObject[3];
[SerializeField] private Animator _catLeft;
[SerializeField] private GameObject[] _catLeftObjectsSmall = new GameObject[4];
[SerializeField] private GameObject[] _catLeftObjectsBig = new GameObject[1];
[SerializeField] private GameObject[] _catLeftObjectsHuge = new GameObject[3];
[Header("Parameters")] [Header("Parameters")]
[SerializeField] private double _catAnimationOffsetStart = -0.5; [SerializeField] private double _catAnimationOffsetStart = -0.5;
[SerializeField] private double _catAnimationOffsetEnd = 0.5; [SerializeField] private double _catAnimationOffsetEnd = 0.5;
private List<double> _bearNoBopBeats = new(); private List<double> _bearNoBopBeats = new();
private Dictionary<double, CatPutChoice> _catPuts = new();
public static LumBEARjack instance; public static LumBEARjack instance;
@ -247,6 +282,7 @@ namespace HeavenStudio.Games
instance = this; instance = this;
SetupBopRegion("lumbearjack", "bop", "auto", false); SetupBopRegion("lumbearjack", "bop", "auto", false);
DisableAllCatRightObjects(); DisableAllCatRightObjects();
DisableAllCatLeftObjects();
} }
#region Update #region Update
@ -263,42 +299,78 @@ namespace HeavenStudio.Games
#region Spawn Objects #region Spawn Objects
public void SpawnSmallObject(double beat, double length, SmallType type, HuhChoice huh, double startUpBeat = -1) public void SpawnSmallObject(double beat, double length, SmallType type, HuhChoice huh, CatPutChoice cat, 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, huh, startUpBeat); spawnedObject.Init(_bear, beat, length, type, huh, ObjectShouldBeRight(beat, cat), startUpBeat);
}) })
}); });
} }
public void SpawnBigObject(double beat, double length, BigType type, double startUpBeat = -1) public void SpawnBigObject(double beat, double length, BigType type, CatPutChoice cat, double startUpBeat = -1)
{ {
BeatAction.New(this, new() BeatAction.New(this, new()
{ {
new(beat + (length / 4), delegate new(beat + (length / 4), delegate
{ {
LBJBigObject spawnedObject = Instantiate(_bigObjectPrefab, _cutObjectHolder); LBJBigObject spawnedObject = Instantiate(_bigObjectPrefab, _cutObjectHolder);
spawnedObject.Init(_bear, beat, length, type, startUpBeat); spawnedObject.Init(_bear, beat, length, type, ObjectShouldBeRight(beat, cat), startUpBeat);
}) })
}); });
} }
public void SpawnHugeObject(double beat, double length, HugeType type, double startUpBeat = -1) public void SpawnHugeObject(double beat, double length, HugeType type, CatPutChoice cat, double startUpBeat = -1)
{ {
BeatAction.New(this, new() BeatAction.New(this, new()
{ {
new(beat + (length / 6), delegate new(beat + (length / 6), delegate
{ {
LBJHugeObject spawnedObject = Instantiate(_hugeObjectPrefab, _cutObjectHolder); LBJHugeObject spawnedObject = Instantiate(_hugeObjectPrefab, _cutObjectHolder);
spawnedObject.Init(_bear, beat, length, type, startUpBeat); spawnedObject.Init(_bear, beat, length, type, ObjectShouldBeRight(beat, cat), startUpBeat);
}) })
}); });
} }
private bool ObjectShouldBeRight(double beat, CatPutChoice cat)
{
switch (cat)
{
case CatPutChoice.Alternate:
bool right = true; // proper start to be implemented
bool first = true;
foreach (var e in _catPuts)
{
if (e.Key > beat) break;
switch (e.Value)
{
case CatPutChoice.Alternate:
if (!first) right = !right;
break;
case CatPutChoice.Right:
right = true;
break;
case CatPutChoice.Left:
right = false;
break;
}
first = false;
}
return right;
// Add checks for if cat is in
case CatPutChoice.Left:
return false;
default:
return true;
}
}
#endregion #endregion
#region StartUp Methods #region StartUp Methods
@ -330,17 +402,17 @@ 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"], (HuhChoice)e["huh"], beat); SpawnSmallObject(e.beat, e.length, (SmallType)e["type"], (HuhChoice)e["huh"], (CatPutChoice)e["cat"], beat);
break; break;
case "big": case "big":
case "bigS": case "bigS":
BigObjectSound(e.beat, e.length, (BigType)e["type"], beat); BigObjectSound(e.beat, e.length, (BigType)e["type"], beat);
SpawnBigObject(e.beat, e.length, (BigType)e["type"], beat); SpawnBigObject(e.beat, e.length, (BigType)e["type"], (CatPutChoice)e["cat"], beat);
break; break;
case "huge": case "huge":
case "hugeS": case "hugeS":
HugeObjectSound(e.beat, e.length, (HugeType)e["type"], beat); HugeObjectSound(e.beat, e.length, (HugeType)e["type"], beat);
SpawnHugeObject(e.beat, e.length, (HugeType)e["type"], beat); SpawnHugeObject(e.beat, e.length, (HugeType)e["type"], (CatPutChoice)e["cat"], beat);
break; break;
} }
} }
@ -396,6 +468,8 @@ namespace HeavenStudio.Games
double nextGameSwitchBeat = double.MaxValue; double nextGameSwitchBeat = double.MaxValue;
if (nextGameSwitch != null) nextGameSwitchBeat = nextGameSwitch.beat; if (nextGameSwitch != null) nextGameSwitchBeat = nextGameSwitch.beat;
bool catRight = true; // again properise
bool first = true;
foreach (var e in allEvents) foreach (var e in allEvents)
{ {
@ -412,23 +486,41 @@ namespace HeavenStudio.Games
if ((e.beat + _catAnimationOffsetStart < beat && e.beat + effectiveLength + _catAnimationOffsetEnd > beat) || (e.beat >= beat && e.beat < nextGameSwitchBeat)) if ((e.beat + _catAnimationOffsetStart < beat && e.beat + effectiveLength + _catAnimationOffsetEnd > beat) || (e.beat >= beat && e.beat < nextGameSwitchBeat))
{ {
if (!_catPuts.ContainsKey(e.beat)) _catPuts.Add(e.beat, (CatPutChoice)e["cat"]);
switch ((CatPutChoice)e["cat"])
{
case CatPutChoice.Alternate:
if (!first) catRight = !catRight;
break;
case CatPutChoice.Left:
catRight = false;
break;
default:
catRight = true;
break;
}
switch (e.datamodel.Split(1)) switch (e.datamodel.Split(1))
{ {
case "small": case "small":
case "smallS": case "smallS":
CatPutObject(e.beat, e.length, (SmallType)e["type"]); CatPutObject(e.beat, e.length, (SmallType)e["type"], catRight);
break; break;
case "big": case "big":
case "bigS": case "bigS":
CatPutObject(e.beat, e.length, (BigType)e["type"]); CatPutObject(e.beat, e.length, (BigType)e["type"], catRight);
break; break;
case "huge": case "huge":
case "hugeS": case "hugeS":
CatPutObject(e.beat, e.length, (HugeType)e["type"]); CatPutObject(e.beat, e.length, (HugeType)e["type"], catRight);
break; break;
} }
} }
first = false;
} }
var sortedCatPuts = _catPuts.OrderBy(x => x.Key);
_catPuts = sortedCatPuts.ToDictionary(pair => pair.Key, pair => pair.Value);
} }
#endregion #endregion
@ -441,15 +533,15 @@ namespace HeavenStudio.Games
{ {
case WhoBops.Both: case WhoBops.Both:
if (!_bearNoBopBeats.Contains(beat)) _bear.Bop(); if (!_bearNoBopBeats.Contains(beat)) _bear.Bop();
if (_catRight.IsPlayingAnimationNames("CatGrab")) break; if (!_catRight.IsPlayingAnimationNames("CatGrab")) _catRight.DoScaledAnimationAsync("CatBop", 0.5f);
_catRight.DoScaledAnimationAsync("CatBop", 0.5f); if (!_catLeft.IsPlayingAnimationNames("CatGrab")) _catLeft.DoScaledAnimationAsync("CatBop", 0.5f);
break; break;
case WhoBops.Bear: case WhoBops.Bear:
if (!_bearNoBopBeats.Contains(beat)) _bear.Bop(); if (!_bearNoBopBeats.Contains(beat)) _bear.Bop();
break; break;
case WhoBops.Cats: case WhoBops.Cats:
if (_catRight.IsPlayingAnimationNames("CatGrab")) break; if (!_catRight.IsPlayingAnimationNames("CatGrab")) _catRight.DoScaledAnimationAsync("CatBop", 0.5f);
_catRight.DoScaledAnimationAsync("CatBop", 0.5f); if (!_catLeft.IsPlayingAnimationNames("CatGrab")) _catLeft.DoScaledAnimationAsync("CatBop", 0.5f);
break; break;
default: default:
break; break;
@ -472,15 +564,15 @@ namespace HeavenStudio.Games
{ {
case WhoBops.Both: case WhoBops.Both:
_bear.Bop(); _bear.Bop();
if (_catRight.IsPlayingAnimationNames("CatGrab")) break; if (!_catRight.IsPlayingAnimationNames("CatGrab")) _catRight.DoScaledAnimationAsync("CatBop", 0.5f);
_catRight.DoScaledAnimationAsync("CatBop", 0.5f); if (!_catLeft.IsPlayingAnimationNames("CatGrab")) _catLeft.DoScaledAnimationAsync("CatBop", 0.5f);
break; break;
case WhoBops.Bear: case WhoBops.Bear:
_bear.Bop(); _bear.Bop();
break; break;
case WhoBops.Cats: case WhoBops.Cats:
if (_catRight.IsPlayingAnimationNames("CatGrab")) break; if (!_catRight.IsPlayingAnimationNames("CatGrab")) _catRight.DoScaledAnimationAsync("CatBop", 0.5f);
_catRight.DoScaledAnimationAsync("CatBop", 0.5f); if (!_catLeft.IsPlayingAnimationNames("CatGrab")) _catLeft.DoScaledAnimationAsync("CatBop", 0.5f);
break; break;
default: default:
break; break;
@ -571,31 +663,44 @@ namespace HeavenStudio.Games
#region Cats #region Cats
private Coroutine _catRightCoroutine; private Coroutine _catRightCoroutine;
private Coroutine _catLeftCoroutine;
public void CatPutObject(double beat, double length, SmallType type) public void CatPutObject(double beat, double length, SmallType type, bool right)
{ {
CatPutObjectExec(beat, length / 3, _catRightObjectsSmall[(int)type]); GameObject objectToUse = right ? _catRightObjectsSmall[(int)type] : _catLeftObjectsSmall[(int)type];
CatPutObjectExec(beat, length / 3, objectToUse, right);
} }
public void CatPutObject(double beat, double length, BigType type) public void CatPutObject(double beat, double length, BigType type, bool right)
{ {
CatPutObjectExec(beat, length / 4, _catRightObjectsBig[(int)type]); GameObject objectToUse = right ? _catRightObjectsBig[(int)type] : _catLeftObjectsBig[(int)type];
CatPutObjectExec(beat, length / 4, objectToUse, right);
} }
public void CatPutObject(double beat, double length, HugeType type) public void CatPutObject(double beat, double length, HugeType type, bool right)
{ {
CatPutObjectExec(beat, length / 6, _catRightObjectsHuge[(int)type]); GameObject objectToUse = right ? _catRightObjectsHuge[(int)type] : _catLeftObjectsHuge[(int)type];
CatPutObjectExec(beat, length / 6, objectToUse, right);
} }
private void CatPutObjectExec(double beat, double effectiveLength, GameObject objectUsed) private void CatPutObjectExec(double beat, double effectiveLength, GameObject objectUsed, bool right)
{ {
BeatAction.New(this, new() BeatAction.New(this, new()
{ {
new(beat + (_catAnimationOffsetStart * effectiveLength), delegate new(beat + (_catAnimationOffsetStart * effectiveLength), delegate
{ {
if (_catRightCoroutine != null) StopCoroutine(_catRightCoroutine); if (right)
DisableAllCatRightObjects(); {
_catRightCoroutine = StartCoroutine(CatPutObjectCo(beat, effectiveLength)); if (_catRightCoroutine != null) StopCoroutine(_catRightCoroutine);
DisableAllCatRightObjects();
_catRightCoroutine = StartCoroutine(CatPutObjectCo(beat, effectiveLength, _catRight));
}
else
{
if (_catLeftCoroutine != null) StopCoroutine(_catLeftCoroutine);
DisableAllCatLeftObjects();
_catLeftCoroutine = StartCoroutine(CatPutObjectCo(beat, effectiveLength, _catLeft));
}
}), }),
new(beat, delegate new(beat, delegate
{ {
@ -603,24 +708,25 @@ namespace HeavenStudio.Games
}), }),
new(beat + effectiveLength, delegate new(beat + effectiveLength, delegate
{ {
DisableAllCatRightObjects(); if (right) DisableAllCatRightObjects();
else DisableAllCatLeftObjects();
}) })
}); });
} }
private IEnumerator CatPutObjectCo(double beat, double effectiveLength) private IEnumerator CatPutObjectCo(double beat, double effectiveLength, Animator cat)
{ {
double s = _catAnimationOffsetStart * effectiveLength; double s = _catAnimationOffsetStart * effectiveLength;
double e = _catAnimationOffsetEnd * effectiveLength; double e = _catAnimationOffsetEnd * effectiveLength;
float normalizedBeat = conductor.GetPositionFromBeat(beat + s, effectiveLength + e - s, false); float normalizedBeat = conductor.GetPositionFromBeat(beat + s, effectiveLength + e - s, false);
_catRight.DoNormalizedAnimation("CatGrab", Mathf.Clamp01(normalizedBeat)); cat.DoNormalizedAnimation("CatGrab", Mathf.Clamp01(normalizedBeat));
while (normalizedBeat <= 1) while (normalizedBeat <= 1)
{ {
normalizedBeat = conductor.GetPositionFromBeat(beat + s, effectiveLength + e - s, false); normalizedBeat = conductor.GetPositionFromBeat(beat + s, effectiveLength + e - s, false);
_catRight.DoNormalizedAnimation("CatGrab", Mathf.Clamp01(normalizedBeat)); cat.DoNormalizedAnimation("CatGrab", Mathf.Clamp01(normalizedBeat));
yield return null; yield return null;
} }
@ -647,6 +753,27 @@ namespace HeavenStudio.Games
} }
} }
private void DisableAllCatLeftObjects()
{
foreach (var g in _catLeftObjectsSmall)
{
if (g == null) continue;
g.SetActive(false);
}
foreach (var g in _catLeftObjectsBig)
{
if (g == null) continue;
g.SetActive(false);
}
foreach (var g in _catLeftObjectsHuge)
{
if (g == null) continue;
g.SetActive(false);
}
}
#endregion #endregion
#region Misc #region Misc