diff --git a/Assets/Prefabs/GameCanvas.prefab b/Assets/Prefabs/GameCanvas.prefab index 4e2149d..b12b539 100644 --- a/Assets/Prefabs/GameCanvas.prefab +++ b/Assets/Prefabs/GameCanvas.prefab @@ -35,7 +35,7 @@ RectTransform: m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} m_AnchoredPosition: {x: 0, y: -45} - m_SizeDelta: {x: 1400, y: 200} + m_SizeDelta: {x: 1400, y: 275} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &1286114954994068795 CanvasRenderer: @@ -58,14 +58,14 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} - m_Color: {r: 0, g: 0.88063455, b: 1, a: 1} + m_Color: {r: 1, g: 1, b: 1, a: 1} m_RaycastTarget: 1 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_Sprite: {fileID: 0} + m_Sprite: {fileID: 21300000, guid: fe05722d1c0421046b275859905cc71e, type: 3} m_Type: 0 m_PreserveAspect: 0 m_FillCenter: 1 @@ -236,7 +236,6 @@ RectTransform: m_Children: - {fileID: 2941306260179374169} - {fileID: 450953812910381365} - - {fileID: 7960376733688604242} - {fileID: 4284223169977514699} m_Father: {fileID: 834552907522022778} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -280,103 +279,6 @@ RectTransform: m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 100, y: 100} m_Pivot: {x: 0.5, y: 0.5} ---- !u!1 &3563736642392842882 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 7960376733688604242} - - component: {fileID: 3987117081994636230} - - component: {fileID: 3457638843023186478} - - component: {fileID: 7487102586556094918} - m_Layer: 5 - m_Name: Continue - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &7960376733688604242 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 3563736642392842882} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 5018153252802778155} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0.5, y: 0.5} - m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 0, y: -75} - m_SizeDelta: {x: 100, y: 100} - m_Pivot: {x: 0.5, y: 0.5} ---- !u!222 &3987117081994636230 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 3563736642392842882} - m_CullTransparentMesh: 1 ---- !u!114 &3457638843023186478 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 3563736642392842882} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Material: {fileID: 0} - m_Color: {r: 1, g: 1, b: 1, a: 1} - m_RaycastTarget: 1 - m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} - m_Maskable: 1 - m_OnCullStateChanged: - m_PersistentCalls: - m_Calls: [] - m_FontData: - m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} - m_FontSize: 20 - m_FontStyle: 0 - m_BestFit: 0 - m_MinSize: 2 - m_MaxSize: 40 - m_Alignment: 4 - m_AlignByGeometry: 0 - m_RichText: 1 - m_HorizontalOverflow: 1 - m_VerticalOverflow: 1 - m_LineSpacing: 1 - m_Text: 'Press SPACE to continue - -' ---- !u!114 &7487102586556094918 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 3563736642392842882} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: e19747de3f5aca642ab2be37e372fb86, type: 3} - m_Name: - m_EditorClassIdentifier: - m_EffectColor: {r: 0, g: 0, b: 0, a: 1} - m_EffectDistance: {x: 2, y: -2} - m_UseGraphicAlpha: 1 --- !u!1 &4509675489510948023 GameObject: m_ObjectHideFlags: 0 @@ -556,7 +458,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} - m_Color: {r: 1, g: 1, b: 1, a: 1} + m_Color: {r: 0.46226418, g: 0.46226418, b: 0.46226418, a: 1} m_RaycastTarget: 1 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 @@ -723,7 +625,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} - m_Color: {r: 1, g: 1, b: 1, a: 1} + m_Color: {r: 0.46226418, g: 0.46226418, b: 0.46226418, a: 1} m_RaycastTarget: 1 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 @@ -816,7 +718,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} m_Name: m_EditorClassIdentifier: - m_Material: {fileID: 0} + m_Material: {fileID: 2100000, guid: 000aea8751e400946b113778df0a9638, type: 2} m_Color: {r: 1, g: 1, b: 1, a: 0.5019608} m_RaycastTarget: 0 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} diff --git a/Assets/RenderTexMat.mat b/Assets/RenderTexMat.mat new file mode 100644 index 0000000..b738d49 --- /dev/null +++ b/Assets/RenderTexMat.mat @@ -0,0 +1,139 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-4441620517217426780 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 7 +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: RenderTexMat + m_Shader: {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: [] + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 1 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _ColorMask: 15 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _DstBlendAlpha: 0 + - _EnvironmentReflections: 1 + - _GlossMapScale: 0 + - _Glossiness: 0 + - _GlossyReflections: 0 + - _Metallic: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.005 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 0.5 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Stencil: 0 + - _StencilComp: 8 + - _StencilOp: 0 + - _StencilReadMask: 255 + - _StencilWriteMask: 255 + - _Surface: 0 + - _UseUIAlphaClip: 0 + - _WorkflowMode: 1 + - _ZWrite: 1 + m_Colors: + - _BaseColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + m_BuildTextureStacks: [] diff --git a/Assets/RenderTexMat.mat.meta b/Assets/RenderTexMat.mat.meta new file mode 100644 index 0000000..b7ae58a --- /dev/null +++ b/Assets/RenderTexMat.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 000aea8751e400946b113778df0a9638 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/WorldScene.unity b/Assets/Scenes/WorldScene.unity index 7efb30b..6a2b1a2 100644 --- a/Assets/Scenes/WorldScene.unity +++ b/Assets/Scenes/WorldScene.unity @@ -1062,67 +1062,11 @@ PrefabInstance: serializedVersion: 3 m_TransformParent: {fileID: 0} m_Modifications: - - target: {fileID: 430841442987754630, guid: e29ce1fe47a855c4e907d4312c9e9d6e, - type: 3} - propertyPath: m_Sprite - value: - objectReference: {fileID: 21300000, guid: fe05722d1c0421046b275859905cc71e, - type: 3} - - target: {fileID: 430841442987754630, guid: e29ce1fe47a855c4e907d4312c9e9d6e, - type: 3} - propertyPath: m_Color.b - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 430841442987754630, guid: e29ce1fe47a855c4e907d4312c9e9d6e, - type: 3} - propertyPath: m_Color.g - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 430841442987754630, guid: e29ce1fe47a855c4e907d4312c9e9d6e, - type: 3} - propertyPath: m_Color.r - value: 1 - objectReference: {fileID: 0} - target: {fileID: 2020022267469913571, guid: e29ce1fe47a855c4e907d4312c9e9d6e, type: 3} propertyPath: m_Name value: GameCanvas objectReference: {fileID: 0} - - target: {fileID: 2020022267469913571, guid: e29ce1fe47a855c4e907d4312c9e9d6e, - type: 3} - propertyPath: m_IsActive - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 2058749420242249500, guid: e29ce1fe47a855c4e907d4312c9e9d6e, - type: 3} - propertyPath: m_IsActive - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3457638843023186478, guid: e29ce1fe47a855c4e907d4312c9e9d6e, - type: 3} - propertyPath: m_Color.b - value: 0.46226418 - objectReference: {fileID: 0} - - target: {fileID: 3457638843023186478, guid: e29ce1fe47a855c4e907d4312c9e9d6e, - type: 3} - propertyPath: m_Color.g - value: 0.46226418 - objectReference: {fileID: 0} - - target: {fileID: 3457638843023186478, guid: e29ce1fe47a855c4e907d4312c9e9d6e, - type: 3} - propertyPath: m_Color.r - value: 0.46226418 - objectReference: {fileID: 0} - - target: {fileID: 3457638843023186478, guid: e29ce1fe47a855c4e907d4312c9e9d6e, - type: 3} - propertyPath: m_FontData.m_MinSize - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3457638843023186478, guid: e29ce1fe47a855c4e907d4312c9e9d6e, - type: 3} - propertyPath: m_FontData.m_FontSize - value: 40 - objectReference: {fileID: 0} - target: {fileID: 3614641596273148411, guid: e29ce1fe47a855c4e907d4312c9e9d6e, type: 3} propertyPath: m_LocalPosition.x @@ -1173,49 +1117,8 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 4017024745020146958, guid: e29ce1fe47a855c4e907d4312c9e9d6e, - type: 3} - propertyPath: m_SizeDelta.y - value: 275 - objectReference: {fileID: 0} - - target: {fileID: 6436671234165154367, guid: e29ce1fe47a855c4e907d4312c9e9d6e, - type: 3} - propertyPath: m_Color.b - value: 0.46226418 - objectReference: {fileID: 0} - - target: {fileID: 6436671234165154367, guid: e29ce1fe47a855c4e907d4312c9e9d6e, - type: 3} - propertyPath: m_Color.g - value: 0.46226418 - objectReference: {fileID: 0} - - target: {fileID: 6436671234165154367, guid: e29ce1fe47a855c4e907d4312c9e9d6e, - type: 3} - propertyPath: m_Color.r - value: 0.46226418 - objectReference: {fileID: 0} - - target: {fileID: 7960376733688604242, guid: e29ce1fe47a855c4e907d4312c9e9d6e, - type: 3} - propertyPath: m_AnchoredPosition.y - value: -79.5 - objectReference: {fileID: 0} - - target: {fileID: 8522275853895335114, guid: e29ce1fe47a855c4e907d4312c9e9d6e, - type: 3} - propertyPath: m_Color.b - value: 0.46226418 - objectReference: {fileID: 0} - - target: {fileID: 8522275853895335114, guid: e29ce1fe47a855c4e907d4312c9e9d6e, - type: 3} - propertyPath: m_Color.g - value: 0.46226418 - objectReference: {fileID: 0} - - target: {fileID: 8522275853895335114, guid: e29ce1fe47a855c4e907d4312c9e9d6e, - type: 3} - propertyPath: m_Color.r - value: 0.46226418 - objectReference: {fileID: 0} m_RemovedComponents: [] - m_RemovedGameObjects: - - {fileID: 3563736642392842882, guid: e29ce1fe47a855c4e907d4312c9e9d6e, type: 3} + m_RemovedGameObjects: [] m_AddedGameObjects: [] m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: e29ce1fe47a855c4e907d4312c9e9d6e, type: 3} diff --git a/Assets/Scripts/SceneController.cs b/Assets/Scripts/SceneController.cs new file mode 100644 index 0000000..02a66f3 --- /dev/null +++ b/Assets/Scripts/SceneController.cs @@ -0,0 +1,103 @@ +using System; +using System.Collections; +using Unity.VisualScripting; +using UnityEngine; +using UnityEngine.SceneManagement; +using UnityEngine.UI; + +namespace InterfaceOff +{ + public class SceneController : MonoBehaviour + { + private static SceneController Instance; + + private RectTransform ImageRectOverlay; + private Canvas OverlayCanvas; + + [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)] + private static void InitializeBeforeSceneLoad() + { + GameObject go = new(nameof(SceneController)); + go.AddComponent(); + + DontDestroyOnLoad(go); + } + + private void Start() + { + OverlayCanvas = transform.AddComponent(); + OverlayCanvas.renderMode = RenderMode.ScreenSpaceOverlay; + OverlayCanvas.worldCamera = Camera.main; + OverlayCanvas.sortingOrder = 1; + + GameObject imageHolder = new("ImageHolder"); + imageHolder.transform.SetParent(OverlayCanvas.transform); + + Image overlayImage = imageHolder.AddComponent(); + overlayImage.color = Color.black; + + ImageRectOverlay = imageHolder.GetComponent(); + + ImageRectOverlay.sizeDelta = new Vector2(0f, 0f); + ImageRectOverlay.anchoredPosition = new Vector2(0f, 0f); + + Instance = this; + } + + private IEnumerator Load(Action loadAction) + { + Time.timeScale = 0.2f; + + Vector2 maxSize = new(2000f, 2000f); + Vector2 minSize = Vector2.zero; + + float startRotation = ImageRectOverlay.eulerAngles.z; + float expandRotation = startRotation + 360f; + float shrinkRotation = expandRotation + 360f; + + float t = 0f; + + while (t < 1f) + { + ImageRectOverlay.sizeDelta = Vector2.Lerp(minSize, maxSize, t); + ImageRectOverlay.rotation = Quaternion.Euler( + 0f, 0f, Mathf.Lerp(startRotation, expandRotation, t)); + + t += Time.unscaledDeltaTime; + yield return null; + } + + ImageRectOverlay.sizeDelta = maxSize; + ImageRectOverlay.rotation = Quaternion.Euler(0f, 0f, expandRotation); + + loadAction?.Invoke(); + + t = 0f; + + while (t < 1f) + { + ImageRectOverlay.sizeDelta = Vector2.Lerp(maxSize, minSize, t); + ImageRectOverlay.rotation = Quaternion.Euler( + 0f, 0f, Mathf.Lerp(expandRotation, shrinkRotation, t)); + + t += Time.unscaledDeltaTime; + yield return null; + } + + ImageRectOverlay.sizeDelta = minSize; + ImageRectOverlay.rotation = Quaternion.Euler(0f, 0f, shrinkRotation); + + Time.timeScale = 1f; + } + + public static void ReloadScene() => Instance.StartCoroutine(routine: Instance.Load(() => + { + SceneManager.LoadScene(SceneManager.GetActiveScene().name); + })); + + public static void Load(string name) => Instance.StartCoroutine(routine: Instance.Load(() => + { + SceneManager.LoadScene(name); + })); + } +} \ No newline at end of file diff --git a/Assets/Scripts/SceneController.cs.meta b/Assets/Scripts/SceneController.cs.meta new file mode 100644 index 0000000..2cd6176 --- /dev/null +++ b/Assets/Scripts/SceneController.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: d0c606b4f4304267978621baca814621 +timeCreated: 1769128030 \ No newline at end of file diff --git a/Assets/Scripts/StartMenuController.cs b/Assets/Scripts/StartMenuController.cs index 5c4b230..72fab23 100644 --- a/Assets/Scripts/StartMenuController.cs +++ b/Assets/Scripts/StartMenuController.cs @@ -7,7 +7,7 @@ namespace InterfaceOff.MainMenu { public void OnStartClick() { - SceneManager.LoadScene("WorldScene"); + SceneController.Load("WorldScene"); } public void OnExitClick() diff --git a/Assets/Scripts/WindowSpawner.cs b/Assets/Scripts/WindowSpawner.cs index 7b12ec5..91dfcf5 100644 --- a/Assets/Scripts/WindowSpawner.cs +++ b/Assets/Scripts/WindowSpawner.cs @@ -3,7 +3,6 @@ using Ext.B83.Unity.Attributes; using InterfaceOff.MainMenu; using InterfaceOff.WorldScene; using UnityEngine; -using UnityEngine.SceneManagement; using Random = UnityEngine.Random; namespace InterfaceOff @@ -119,8 +118,7 @@ namespace InterfaceOff /* Else checks if it should reload the scene */ else if (Input.GetKey(KeyCode.Space)) { - int sceneIndex = SceneManager.GetActiveScene().buildIndex; - SceneManager.LoadScene(sceneIndex); + SceneController.ReloadScene(); } }