From 2d996ba3c1a5a8478e7221d564d58d8babc8f54d Mon Sep 17 00:00:00 2001 From: Jenny Crowe Date: Sun, 20 Feb 2022 06:57:20 -0700 Subject: [PATCH] Rhythm Rally: Fixed broken background in editor preview. FreeCam components can now be enabled/disabled with ctrl+shift+D. --- Assets/Resources/Games/builtToScaleDS.prefab | 2 +- Assets/Resources/Games/rhythmRally.prefab | 6 +++--- Assets/Scripts/GameManager.cs | 2 +- Assets/Scripts/LevelEditor/Editor.cs | 21 ++++++++++++++++++++ 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/Assets/Resources/Games/builtToScaleDS.prefab b/Assets/Resources/Games/builtToScaleDS.prefab index 0899a629..95ba6148 100644 --- a/Assets/Resources/Games/builtToScaleDS.prefab +++ b/Assets/Resources/Games/builtToScaleDS.prefab @@ -311,7 +311,7 @@ MonoBehaviour: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 4052947733920485538} - m_Enabled: 1 + m_Enabled: 0 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: a0e5d5d77f9b8824b997a02d704003ef, type: 3} m_Name: diff --git a/Assets/Resources/Games/rhythmRally.prefab b/Assets/Resources/Games/rhythmRally.prefab index 9835690a..e8058d7f 100644 --- a/Assets/Resources/Games/rhythmRally.prefab +++ b/Assets/Resources/Games/rhythmRally.prefab @@ -407,7 +407,7 @@ SpriteRenderer: m_Size: {x: 1, y: 1} m_AdaptiveModeThreshold: 0.5 m_SpriteTileMode: 0 - m_WasSpriteAssigned: 1 + m_WasSpriteAssigned: 0 m_MaskInteraction: 0 m_SpriteSortPoint: 0 --- !u!1 &1871413452992259420 @@ -974,7 +974,7 @@ Camera: m_Enabled: 1 serializedVersion: 2 m_ClearFlags: 2 - m_BackGroundColor: {r: 1, g: 1, b: 1, a: 0} + m_BackGroundColor: {r: 1, g: 1, b: 1, a: 1} m_projectionMatrixMode: 1 m_GateFitMode: 2 m_FOVAxisMode: 0 @@ -1047,7 +1047,7 @@ MonoBehaviour: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 4052947733920485538} - m_Enabled: 1 + m_Enabled: 0 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: a0e5d5d77f9b8824b997a02d704003ef, type: 3} m_Name: diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs index 6c7e278b..7177ac81 100644 --- a/Assets/Scripts/GameManager.cs +++ b/Assets/Scripts/GameManager.cs @@ -34,7 +34,7 @@ namespace RhythmHeavenMania public float startOffset; public bool playOnStart; public float startBeat; - private GameObject currentGameO; + [NonSerialized] public GameObject currentGameO; public bool autoplay; public event Action onBeatChanged; diff --git a/Assets/Scripts/LevelEditor/Editor.cs b/Assets/Scripts/LevelEditor/Editor.cs index b5c4d845..351b5cec 100644 --- a/Assets/Scripts/LevelEditor/Editor.cs +++ b/Assets/Scripts/LevelEditor/Editor.cs @@ -134,6 +134,14 @@ namespace RhythmHeavenMania.Editor { CommandManager.instance.Redo(); } + + if (Input.GetKey(KeyCode.LeftShift)) + { + if (Input.GetKeyDown(KeyCode.D)) + { + ToggleDebugCam(); + } + } } if (Timeline.instance.timelineState.selected && Editor.instance.canSelect) @@ -415,5 +423,18 @@ namespace RhythmHeavenMania.Editor { return (rectTransform.gameObject.activeSelf && RectTransformUtility.RectangleContainsScreenPoint(rectTransform, Input.mousePosition, Editor.instance.EditorCamera)); } + + public void ToggleDebugCam() + { + var game = GameManager.instance.currentGameO; + + if (game != null) + { + foreach(FreeCam c in game.GetComponentsInChildren(true)) + { + c.enabled = !c.enabled; + } + } + } } } \ No newline at end of file