diff --git a/Assets/Resources/Games/lumbearjack.prefab b/Assets/Resources/Games/lumbearjack.prefab index 1fa3d7434..6e2234490 100644 --- a/Assets/Resources/Games/lumbearjack.prefab +++ b/Assets/Resources/Games/lumbearjack.prefab @@ -296,7 +296,7 @@ Transform: - {fileID: 6382023476871671071} - {fileID: 6928018856485179324} m_Father: {fileID: 2298792418077467027} - m_RootOrder: 4 + m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!95 &6525566897441854329 Animator: @@ -773,6 +773,7 @@ Transform: - {fileID: 3867080228037786540} - {fileID: 5426823713711891276} - {fileID: 8968276012044984537} + - {fileID: 6081244242579349435} - {fileID: 1786682412932371778} - {fileID: 615325631333663386} m_Father: {fileID: 0} @@ -809,6 +810,18 @@ MonoBehaviour: - {fileID: 7195153636254270523} - {fileID: 8599624938353215766} - {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 _catAnimationOffsetEnd: 0.5 --- !u!1 &3527631078867808426 @@ -1683,7 +1696,7 @@ Transform: m_Children: - {fileID: 3909255085184453611} m_Father: {fileID: 2298792418077467027} - m_RootOrder: 5 + m_RootOrder: 6 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!212 &2822577256614703768 SpriteRenderer: @@ -2688,6 +2701,153 @@ Transform: m_Father: {fileID: 8003342604478868877} m_RootOrder: 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 PrefabInstance: m_ObjectHideFlags: 0 @@ -2711,6 +2871,10 @@ PrefabInstance: propertyPath: m_Materials.Array.data[0] value: 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} propertyPath: m_FlipY value: 1 diff --git a/Assets/Scripts/Games/LumBEARjack/LBJBigObject.cs b/Assets/Scripts/Games/LumBEARjack/LBJBigObject.cs index ed001b7a4..43385d332 100644 --- a/Assets/Scripts/Games/LumBEARjack/LBJBigObject.cs +++ b/Assets/Scripts/Games/LumBEARjack/LBJBigObject.cs @@ -18,15 +18,18 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack private LBJBear _bear; private LumBEARjack.BigType _type; + private bool _right = true; + private PlayerActionEvent _cutActionEvent; private double _rotationBeat; 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; _type = type; + _right = right; _rotationBeat = beat + (length / 4 * 2); _rotationLength = length / 4; @@ -47,7 +50,7 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack var func = EasingFunction.GetEasingFunction(_ease); 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) diff --git a/Assets/Scripts/Games/LumBEARjack/LBJHugeObject.cs b/Assets/Scripts/Games/LumBEARjack/LBJHugeObject.cs index 3e30362d9..383572823 100644 --- a/Assets/Scripts/Games/LumBEARjack/LBJHugeObject.cs +++ b/Assets/Scripts/Games/LumBEARjack/LBJHugeObject.cs @@ -2,6 +2,7 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; using HeavenStudio.Util; +using static HeavenStudio.Games.Scripts_AirRally.Cloud; namespace HeavenStudio.Games.Scripts_LumBEARjack { @@ -22,6 +23,8 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack private LBJBear _bear; private LumBEARjack.HugeType _type; + private bool _right = true; + private PlayerActionEvent[] _soundsToDeleteIfMiss = new PlayerActionEvent[3]; private double _rotationBeat; @@ -34,10 +37,11 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack _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; _type = type; + _right = right; switch (type) { @@ -89,7 +93,7 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack var func = EasingFunction.GetEasingFunction(_ease); 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) diff --git a/Assets/Scripts/Games/LumBEARjack/LBJSmallObject.cs b/Assets/Scripts/Games/LumBEARjack/LBJSmallObject.cs index b4bfc0588..e91d82977 100644 --- a/Assets/Scripts/Games/LumBEARjack/LBJSmallObject.cs +++ b/Assets/Scripts/Games/LumBEARjack/LBJSmallObject.cs @@ -22,6 +22,7 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack private LBJBear _bear; private LumBEARjack.SmallType _type; private LumBEARjack.HuhChoice _huh; + private bool _right = true; private double _rotationBeat; private double _rotationLength; @@ -34,11 +35,12 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack _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; _type = type; _huh = huh; + _right = right; switch (type) { @@ -71,7 +73,7 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack var func = EasingFunction.GetEasingFunction(_ease); 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) @@ -95,13 +97,11 @@ namespace HeavenStudio.Games.Scripts_LumBEARjack }; SoundByte.PlayOneShotGame("lumbearjack/" + cutSound); - // 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); + _bear.Cut(caller.startBeat + caller.timer, _type != LumBEARjack.SmallType.log, !_right); break; case LumBEARjack.HuhChoice.On: SoundByte.PlayOneShotGame("lumbearjack/huh", caller.startBeat + caller.timer + 1); diff --git a/Assets/Scripts/Games/LumBEARjack/LumBEARjack.cs b/Assets/Scripts/Games/LumBEARjack/LumBEARjack.cs index f4ac11aa8..f2f38c931 100644 --- a/Assets/Scripts/Games/LumBEARjack/LumBEARjack.cs +++ b/Assets/Scripts/Games/LumBEARjack/LumBEARjack.cs @@ -45,14 +45,15 @@ namespace HeavenStudio.Games.Loaders function = delegate { 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, parameters = new() { new("type", LumBEARjack.SmallType.log, "Type"), 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") @@ -66,13 +67,14 @@ namespace HeavenStudio.Games.Loaders function = delegate { 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, parameters = new() { 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") @@ -86,13 +88,22 @@ namespace HeavenStudio.Games.Loaders function = delegate { 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, parameters = new() { 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") @@ -123,14 +134,15 @@ namespace HeavenStudio.Games.Loaders function = delegate { 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, parameters = new() { new("type", LumBEARjack.SmallType.log, "Type"), 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 }, @@ -145,13 +157,14 @@ namespace HeavenStudio.Games.Loaders function = delegate { 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, parameters = new() { new("type", LumBEARjack.BigType.log, "Type"), - new("sound", true, "Cue Sound") + new("sound", true, "Cue Sound"), + new("cat", LumBEARjack.CatPutChoice.Alternate, "Side") }, resizable = true }, @@ -166,13 +179,14 @@ namespace HeavenStudio.Games.Loaders function = delegate { 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, parameters = new() { new("type", LumBEARjack.HugeType.log, "Type"), - new("sound", true, "Cue Sound") + new("sound", true, "Cue Sound"), + new("cat", LumBEARjack.CatPutChoice.Alternate, "Side") }, resizable = true }, @@ -223,22 +237,43 @@ namespace HeavenStudio.Games On } + public enum CatPutChoice + { + Alternate, + Right, + Left + } + + public enum MainCatChoice + { + Right, + Left, + Both + } + [Header("Components")] [SerializeField] private LBJBear _bear; [SerializeField] private LBJSmallObject _smallObjectPrefab; [SerializeField] private LBJBigObject _bigObjectPrefab; [SerializeField] private LBJHugeObject _hugeObjectPrefab; [SerializeField] private Transform _cutObjectHolder; + [SerializeField] private Animator _catRight; [SerializeField] private GameObject[] _catRightObjectsSmall = new GameObject[4]; [SerializeField] private GameObject[] _catRightObjectsBig = new GameObject[1]; [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")] [SerializeField] private double _catAnimationOffsetStart = -0.5; [SerializeField] private double _catAnimationOffsetEnd = 0.5; private List _bearNoBopBeats = new(); + private Dictionary _catPuts = new(); public static LumBEARjack instance; @@ -247,6 +282,7 @@ namespace HeavenStudio.Games instance = this; SetupBopRegion("lumbearjack", "bop", "auto", false); DisableAllCatRightObjects(); + DisableAllCatLeftObjects(); } #region Update @@ -263,42 +299,78 @@ namespace HeavenStudio.Games #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() { new(beat + (length / 3), delegate { 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() { new(beat + (length / 4), delegate { 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() { new(beat + (length / 6), delegate { 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 #region StartUp Methods @@ -330,17 +402,17 @@ namespace HeavenStudio.Games case "small": case "smallS": 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; case "big": case "bigS": 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; case "huge": case "hugeS": 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; } } @@ -396,6 +468,8 @@ namespace HeavenStudio.Games double nextGameSwitchBeat = double.MaxValue; if (nextGameSwitch != null) nextGameSwitchBeat = nextGameSwitch.beat; + bool catRight = true; // again properise + bool first = true; 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 (!_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)) { case "small": case "smallS": - CatPutObject(e.beat, e.length, (SmallType)e["type"]); + CatPutObject(e.beat, e.length, (SmallType)e["type"], catRight); break; case "big": case "bigS": - CatPutObject(e.beat, e.length, (BigType)e["type"]); + CatPutObject(e.beat, e.length, (BigType)e["type"], catRight); break; case "huge": case "hugeS": - CatPutObject(e.beat, e.length, (HugeType)e["type"]); + CatPutObject(e.beat, e.length, (HugeType)e["type"], catRight); break; } - } + } + + first = false; } + var sortedCatPuts = _catPuts.OrderBy(x => x.Key); + _catPuts = sortedCatPuts.ToDictionary(pair => pair.Key, pair => pair.Value); } #endregion @@ -441,15 +533,15 @@ namespace HeavenStudio.Games { case WhoBops.Both: if (!_bearNoBopBeats.Contains(beat)) _bear.Bop(); - if (_catRight.IsPlayingAnimationNames("CatGrab")) break; - _catRight.DoScaledAnimationAsync("CatBop", 0.5f); + if (!_catRight.IsPlayingAnimationNames("CatGrab")) _catRight.DoScaledAnimationAsync("CatBop", 0.5f); + if (!_catLeft.IsPlayingAnimationNames("CatGrab")) _catLeft.DoScaledAnimationAsync("CatBop", 0.5f); break; case WhoBops.Bear: if (!_bearNoBopBeats.Contains(beat)) _bear.Bop(); break; case WhoBops.Cats: - if (_catRight.IsPlayingAnimationNames("CatGrab")) break; - _catRight.DoScaledAnimationAsync("CatBop", 0.5f); + if (!_catRight.IsPlayingAnimationNames("CatGrab")) _catRight.DoScaledAnimationAsync("CatBop", 0.5f); + if (!_catLeft.IsPlayingAnimationNames("CatGrab")) _catLeft.DoScaledAnimationAsync("CatBop", 0.5f); break; default: break; @@ -472,15 +564,15 @@ namespace HeavenStudio.Games { case WhoBops.Both: _bear.Bop(); - if (_catRight.IsPlayingAnimationNames("CatGrab")) break; - _catRight.DoScaledAnimationAsync("CatBop", 0.5f); + if (!_catRight.IsPlayingAnimationNames("CatGrab")) _catRight.DoScaledAnimationAsync("CatBop", 0.5f); + if (!_catLeft.IsPlayingAnimationNames("CatGrab")) _catLeft.DoScaledAnimationAsync("CatBop", 0.5f); break; case WhoBops.Bear: _bear.Bop(); break; case WhoBops.Cats: - if (_catRight.IsPlayingAnimationNames("CatGrab")) break; - _catRight.DoScaledAnimationAsync("CatBop", 0.5f); + if (!_catRight.IsPlayingAnimationNames("CatGrab")) _catRight.DoScaledAnimationAsync("CatBop", 0.5f); + if (!_catLeft.IsPlayingAnimationNames("CatGrab")) _catLeft.DoScaledAnimationAsync("CatBop", 0.5f); break; default: break; @@ -571,31 +663,44 @@ namespace HeavenStudio.Games #region Cats 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() { new(beat + (_catAnimationOffsetStart * effectiveLength), delegate { - if (_catRightCoroutine != null) StopCoroutine(_catRightCoroutine); - DisableAllCatRightObjects(); - _catRightCoroutine = StartCoroutine(CatPutObjectCo(beat, effectiveLength)); + if (right) + { + 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 { @@ -603,24 +708,25 @@ namespace HeavenStudio.Games }), 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 e = _catAnimationOffsetEnd * effectiveLength; 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) { normalizedBeat = conductor.GetPositionFromBeat(beat + s, effectiveLength + e - s, false); - _catRight.DoNormalizedAnimation("CatGrab", Mathf.Clamp01(normalizedBeat)); + cat.DoNormalizedAnimation("CatGrab", Mathf.Clamp01(normalizedBeat)); 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 #region Misc