diff --git a/Assets/Resources/Games/totemClimb.prefab b/Assets/Resources/Games/totemClimb.prefab index c4a764b36..e0b78d8a6 100644 --- a/Assets/Resources/Games/totemClimb.prefab +++ b/Assets/Resources/Games/totemClimb.prefab @@ -210,6 +210,90 @@ MonoBehaviour: _jumperPointLeft: {fileID: 644641883719781763} _jumperPointMiddle: {fileID: 7994465469293337682} _jumperPointRight: {fileID: 2412478017021253490} +--- !u!1 &379825893832054225 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 842109065548195641} + - component: {fileID: 7783494143999750819} + m_Layer: 0 + m_Name: pillartop + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &842109065548195641 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 379825893832054225} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0.13, y: 10.5, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1586514379553918595} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &7783494143999750819 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 379825893832054225} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: -49 + m_Sprite: {fileID: 1905395231, guid: 22580b5add5c70f4f81c7733a7798be2, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 8, y: 8.35} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 --- !u!1 &516513247633929993 GameObject: m_ObjectHideFlags: 0 @@ -322,7 +406,8 @@ Transform: m_LocalPosition: {x: -5.047, y: 1.52, z: 0} m_LocalScale: {x: 0.584, y: 0.584, z: 1} m_ConstrainProportionsScale: 0 - m_Children: [] + m_Children: + - {fileID: 7860377758576602599} m_Father: {fileID: 6499924889799669646} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -5794,6 +5879,90 @@ MonoBehaviour: _xDistance: 3.838 _yDistance: 1.45 _totemAmount: 12 +--- !u!1 &3203989406350842060 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8883374520212054008} + - component: {fileID: 4740524760463226026} + m_Layer: 0 + m_Name: pillartop + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &8883374520212054008 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3203989406350842060} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0.13, y: 10.499998, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 9098506625303270995} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &4740524760463226026 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3203989406350842060} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: -49 + m_Sprite: {fileID: 1905395231, guid: 22580b5add5c70f4f81c7733a7798be2, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 8, y: 8.35} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 --- !u!1 &3348864632594356164 GameObject: m_ObjectHideFlags: 0 @@ -15569,6 +15738,90 @@ Transform: m_Father: {fileID: 2336920341491673653} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &4013416909624138788 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7860377758576602599} + - component: {fileID: 5182725981313927543} + m_Layer: 0 + m_Name: pillartop + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &7860377758576602599 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4013416909624138788} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0.13, y: 10.5, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 3318868258064954905} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &5182725981313927543 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4013416909624138788} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: -49 + m_Sprite: {fileID: 1905395231, guid: 22580b5add5c70f4f81c7733a7798be2, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 8, y: 8.35} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 --- !u!1 &4211015855081557403 GameObject: m_ObjectHideFlags: 0 @@ -15735,6 +15988,7 @@ MonoBehaviour: _scrollTransform: {fileID: 7036195930893080952} _jumper: {fileID: 879795961227326402} _totemManager: {fileID: 1758579984411066365} + _pillarManager: {fileID: 8594337538676880471} _scrollSpeedX: 3.838 _scrollSpeedY: 1.45 --- !u!1 &4543646023735205506 @@ -16942,7 +17196,8 @@ Transform: m_LocalPosition: {x: -8.885, y: 11.62, z: 0} m_LocalScale: {x: 0.584, y: 0.584, z: 1} m_ConstrainProportionsScale: 0 - m_Children: [] + m_Children: + - {fileID: 842109065548195641} m_Father: {fileID: 6499924889799669646} m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -17362,7 +17617,8 @@ Transform: m_LocalPosition: {x: -8.885, y: 1.52, z: 0} m_LocalScale: {x: 0.584, y: 0.584, z: 1} m_ConstrainProportionsScale: 0 - m_Children: [] + m_Children: + - {fileID: 8883374520212054008} m_Father: {fileID: 6499924889799669646} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/Assets/Resources/Sprites/Games/TotemClimb/backgroundtotem.png b/Assets/Resources/Sprites/Games/TotemClimb/backgroundtotem.png index 25dc40db5..64d9322c9 100644 Binary files a/Assets/Resources/Sprites/Games/TotemClimb/backgroundtotem.png and b/Assets/Resources/Sprites/Games/TotemClimb/backgroundtotem.png differ diff --git a/Assets/Resources/Sprites/Games/TotemClimb/backgroundtotem.png.meta b/Assets/Resources/Sprites/Games/TotemClimb/backgroundtotem.png.meta index f993348d4..0790c3edf 100644 --- a/Assets/Resources/Sprites/Games/TotemClimb/backgroundtotem.png.meta +++ b/Assets/Resources/Sprites/Games/TotemClimb/backgroundtotem.png.meta @@ -146,6 +146,27 @@ TextureImporter: indices: edges: [] weights: [] + - serializedVersion: 2 + name: pillartop + rect: + serializedVersion: 2 + x: 1651 + y: 28 + width: 800 + height: 835 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: 2a5ab82cd8366454d92c65c3147a357b + internalID: 1905395231 + vertices: [] + indices: + edges: [] + weights: [] outline: [] physicsShape: [] bones: [] @@ -159,6 +180,7 @@ TextureImporter: nameFileIdTable: ground: 1150890885 pillar: 589082449 + pillartop: 1905395231 spritePackingTag: pSDRemoveMatte: 0 pSDShowRemoveMatteOption: 0 diff --git a/Assets/Resources/Sprites/Games/TotemClimb/totemclimb.png b/Assets/Resources/Sprites/Games/TotemClimb/totemclimb.png index ea4fa76aa..cd982b14d 100644 Binary files a/Assets/Resources/Sprites/Games/TotemClimb/totemclimb.png and b/Assets/Resources/Sprites/Games/TotemClimb/totemclimb.png differ diff --git a/Assets/Scripts/Games/TotemClimb/TCPillarManager.cs b/Assets/Scripts/Games/TotemClimb/TCPillarManager.cs index 278df8c12..9d8543aa9 100644 --- a/Assets/Scripts/Games/TotemClimb/TCPillarManager.cs +++ b/Assets/Scripts/Games/TotemClimb/TCPillarManager.cs @@ -2,13 +2,14 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; using System.Linq; +using HeavenStudio.Util; namespace HeavenStudio.Games.Scripts_TotemClimb { public class TCPillarManager : MonoBehaviour { private const int PILLAR_AMOUNT_X = 12; - private const int PILLAR_AMOUNT_Y = 4; + private const int PILLAR_AMOUNT_Y = 3; [Header("Components")] [SerializeField] private Transform _pillarFirst; @@ -27,9 +28,13 @@ namespace HeavenStudio.Games.Scripts_TotemClimb private int _pillarIndexX = 0; private int _pillarIndexY = 0; + private float _endDistance = float.MaxValue; + private bool _hasReachedEnd = false; + private void Awake() { _scrollTransform = transform.parent; + _endDistance = ((float)GetBeatDistance() * 1.45f) + _pillarStartY; _pillarStartX = _pillarFirst.localPosition.x; _pillarDistanceX = _pillarSecond.localPosition.x - _pillarFirst.localPosition.x; @@ -42,14 +47,32 @@ namespace HeavenStudio.Games.Scripts_TotemClimb _pillars[0].Add(_pillarSecond); _pillars[1].Add(_pillarUp); - for (int i = 0; i < PILLAR_AMOUNT_Y; i++) + if (_pillarFirst.localPosition.y >= _endDistance) { + _pillarFirst.GetChild(0).gameObject.SetActive(true); + _pillarSecond.GetChild(0).gameObject.SetActive(true); + _pillarUp.gameObject.SetActive(false); + } + else if (_pillarUp.localPosition.y >= _endDistance) + { + _pillarUp.GetChild(0).gameObject.SetActive(true); + } + + for (int i = 0; i < PILLAR_AMOUNT_Y; i++) + { + if (_hasReachedEnd) break; for (int j = 0; j < PILLAR_AMOUNT_X; j++) { if (_pillars.ElementAtOrDefault(i).ElementAtOrDefault(j) != null) continue; Transform spawnedPillar = Instantiate(_pillarFirst, transform); spawnedPillar.localPosition = new Vector3(_pillarStartX + (_pillarDistanceX * j), spawnedPillar.localPosition.y + (_pillarDistanceY * i)); _pillars[i].Add(spawnedPillar); + + if (spawnedPillar.localPosition.y >= _endDistance) + { + spawnedPillar.GetChild(0).gameObject.SetActive(true); + _hasReachedEnd = true; + } } } } @@ -63,25 +86,62 @@ namespace HeavenStudio.Games.Scripts_TotemClimb { foreach (var pillarRow in _pillars) { + if (pillarRow.Count <= _pillarIndexX % PILLAR_AMOUNT_X) continue; var p = pillarRow[_pillarIndexX % PILLAR_AMOUNT_X]; - + if (p == null) continue; p.localPosition = new Vector3(p.localPosition.x + (_pillarDistanceX * PILLAR_AMOUNT_X), p.localPosition.y); } _pillarIndexX++; + Update(); } + + if (_hasReachedEnd) return; float currentScrollY = _scrollTransform.localPosition.y; - float currentDistanceY = _pillarStartY + (_pillarDistanceY * _pillarIndexY); + float currentDistanceY = _pillarStartY + (_pillarDistanceY * _pillarIndexY) + (_pillarDistanceY * PILLAR_AMOUNT_Y / 2); - if (currentScrollY >= currentDistanceY + (_pillarDistanceY * PILLAR_AMOUNT_Y / 2)) + if (currentScrollY >= currentDistanceY) { foreach (var p in _pillars[_pillarIndexY % PILLAR_AMOUNT_Y]) { - p.localPosition = new Vector3(p.localPosition.x, p.localPosition.y + (_pillarDistanceY * PILLAR_AMOUNT_Y)); + if (p == null) continue; + p.localPosition = new Vector3(p.localPosition.x, p.localPosition.y + (_pillarDistanceY * PILLAR_AMOUNT_Y)); + + if (currentDistanceY >= _endDistance) + { + p.GetChild(0).gameObject.SetActive(true); + _hasReachedEnd = true; + } } + _pillarIndexY++; + Update(); } } + + private double GetBeatDistance() + { + var allGameSwitches = EventCaller.GetAllInGameManagerList("gameManager", new string[] { "switchGame" }).FindAll(x => x.beat <= Conductor.instance.songPositionInBeatsAsDouble && x.datamodel is "gameManager/switchGame/totemClimb"); + double lastGameSwitchBeat = 0; + if (allGameSwitches.Count > 0) lastGameSwitchBeat = allGameSwitches[^1].beat; + + var nextGameSwitches = EventCaller.GetAllInGameManagerList("gameManager", new string[] { "switchGame" }).FindAll(x => x.beat > lastGameSwitchBeat && x.datamodel != "gameManager/switchGame/totemClimb"); + double nextGameSwitchBeat = double.MaxValue; + if (nextGameSwitches.Count > 0) + { + nextGameSwitchBeat = nextGameSwitches[0].beat; + } + + var allStarts = EventCaller.GetAllInGameManagerList("totemClimb", new string[] { "start" }).FindAll(x => x.beat >= lastGameSwitchBeat && x.beat < nextGameSwitchBeat); + if (allStarts.Count == 0) return double.MaxValue; + + double startBeat = allStarts[0].beat; + + var allPillarEnds = EventCaller.GetAllInGameManagerList("totemClimb", new string[] { "above" }).FindAll(x => x.beat >= startBeat && x.beat < nextGameSwitchBeat); + if (allPillarEnds.Count == 0) return double.MaxValue; + + return allPillarEnds[0].beat - startBeat; + } } } diff --git a/Assets/Scripts/Games/TotemClimb/TotemClimb.cs b/Assets/Scripts/Games/TotemClimb/TotemClimb.cs index 776a48e9f..20490af40 100644 --- a/Assets/Scripts/Games/TotemClimb/TotemClimb.cs +++ b/Assets/Scripts/Games/TotemClimb/TotemClimb.cs @@ -39,6 +39,10 @@ namespace HeavenStudio.Games.Loaders }, false, true); }, defaultLength = 4f + }, + new("above", "Pillar End") + { + }, new("stop", "Stop Jumping") { @@ -70,9 +74,14 @@ namespace HeavenStudio.Games [SerializeField] private float _scrollSpeedY = 1.45f; private double _startBeat = double.MaxValue; + public double StartBeat => _startBeat; + private double _endBeat = double.MaxValue; public double EndBeat => _endBeat; + private double _pillarEndBeat = double.MaxValue; + public double PillarEndBeat => _pillarEndBeat; + [NonSerialized] public List _tripleEvents = new(); [NonSerialized] public List _highJumpEvents = new(); @@ -125,6 +134,9 @@ namespace HeavenStudio.Games new(_startBeat - 1, delegate { _jumper.StartJumping(_startBeat - 1); }) }); + var allPillarEnds = EventCaller.GetAllInGameManagerList("totemClimb", new string[] { "above" }).FindAll(x => x.beat >= _startBeat && x.beat < nextGameSwitchBeat); + if (allPillarEnds.Count > 0) _pillarEndBeat = allPillarEnds[0].beat; + var allStops = EventCaller.GetAllInGameManagerList("totemClimb", new string[] { "stop" }).FindAll(x => x.beat > _startBeat && x.beat < nextGameSwitchBeat); if (allStops.Count == 0) return;