Compare commits

...

2 commits

Author SHA1 Message Date
Mark Joshwel a00f8c9b7c unity: oddities 2024-08-11 13:05:36 +08:00
Mark Joshwel ce7aec894a game(ui): working start game
next up, overlays
2024-08-11 13:05:00 +08:00
11 changed files with 353 additions and 102 deletions

View file

@ -1,34 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
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: fcf7219bab7fe46a1ad266029b2fee19, type: 3}
m_Name: Readme
m_EditorClassIdentifier:
icon: {fileID: 2800000, guid: 727a75301c3d24613a3ebcec4a24c2c8, type: 3}
title: URP Empty Template
sections:
- heading: Welcome to the Universal Render Pipeline
text: This template includes the settings and assets you need to start creating with the Universal Render Pipeline.
linkText:
url:
- heading: URP Documentation
text:
linkText: Read more about URP
url: https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@latest
- heading: Forums
text:
linkText: Get answers and support
url: https://forum.unity.com/forums/universal-render-pipeline.383/
- heading: Report bugs
text:
linkText: Submit a report
url: https://unity3d.com/unity/qa/bug-reporting
loadedLayout: 1

View file

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 8105016687592461f977c054a80ce2f2
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

View file

@ -130,6 +130,11 @@ PrefabInstance:
serializedVersion: 3 serializedVersion: 3
m_TransformParent: {fileID: 0} m_TransformParent: {fileID: 0}
m_Modifications: m_Modifications:
- target: {fileID: 974238578668270704, guid: c708a3b79cd542b42bbfedb17e213bc1,
type: 3}
propertyPath: m_Layer
value: 6
objectReference: {fileID: 0}
- target: {fileID: 2119775930974504096, guid: c708a3b79cd542b42bbfedb17e213bc1, - target: {fileID: 2119775930974504096, guid: c708a3b79cd542b42bbfedb17e213bc1,
type: 3} type: 3}
propertyPath: m_LocalPosition.x propertyPath: m_LocalPosition.x
@ -205,6 +210,11 @@ PrefabInstance:
propertyPath: m_BackGroundColor.r propertyPath: m_BackGroundColor.r
value: 0 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 5542111180780342642, guid: c708a3b79cd542b42bbfedb17e213bc1,
type: 3}
propertyPath: m_TagString
value: MainCamera
objectReference: {fileID: 0}
- target: {fileID: 8047161636021232021, guid: c708a3b79cd542b42bbfedb17e213bc1, - target: {fileID: 8047161636021232021, guid: c708a3b79cd542b42bbfedb17e213bc1,
type: 3} type: 3}
propertyPath: m_Name propertyPath: m_Name
@ -6421,6 +6431,134 @@ Transform:
m_Children: [] m_Children: []
m_Father: {fileID: 596429548} m_Father: {fileID: 596429548}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &438254293
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 438254297}
- component: {fileID: 438254296}
- component: {fileID: 438254294}
m_Layer: 0
m_Name: Menu Camera
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &438254294
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 438254293}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a79441f348de89743a2939f4d699eac1, type: 3}
m_Name:
m_EditorClassIdentifier:
m_RenderShadows: 1
m_RequiresDepthTextureOption: 2
m_RequiresOpaqueTextureOption: 2
m_CameraType: 0
m_Cameras: []
m_RendererIndex: -1
m_VolumeLayerMask:
serializedVersion: 2
m_Bits: 1
m_VolumeTrigger: {fileID: 0}
m_VolumeFrameworkUpdateModeOption: 2
m_RenderPostProcessing: 0
m_Antialiasing: 0
m_AntialiasingQuality: 2
m_StopNaN: 0
m_Dithering: 0
m_ClearDepth: 1
m_AllowXRRendering: 1
m_AllowHDROutput: 1
m_UseScreenCoordOverride: 0
m_ScreenSizeOverride: {x: 0, y: 0, z: 0, w: 0}
m_ScreenCoordScaleBias: {x: 0, y: 0, z: 0, w: 0}
m_RequiresDepthTexture: 0
m_RequiresColorTexture: 0
m_Version: 2
m_TaaSettings:
m_Quality: 3
m_FrameInfluence: 0.1
m_JitterScale: 1
m_MipBias: 0
m_VarianceClampScale: 0.9
m_ContrastAdaptiveSharpening: 0
--- !u!20 &438254296
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 438254293}
m_Enabled: 0
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0, g: 0, b: 0, a: 1}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
m_Iso: 200
m_ShutterSpeed: 0.005
m_Aperture: 16
m_FocusDistance: 10
m_FocalLength: 50
m_BladeCount: 5
m_Curvature: {x: 2, y: 11}
m_BarrelClipping: 0.25
m_Anamorphism: 0
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 41
orthographic: 0
orthographic size: 5
m_Depth: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!4 &438254297
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 438254293}
serializedVersion: 2
m_LocalRotation: {x: 0.18497393, y: 0.31016016, z: -0.06165812, w: 0.93047494}
m_LocalPosition: {x: -29.02, y: 17.25, z: -50.76}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 22.487, y: 36.87, z: 0}
--- !u!1 &465465103 --- !u!1 &465465103
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -7636,7 +7774,7 @@ GameObject:
- component: {fileID: 618797800} - component: {fileID: 618797800}
- component: {fileID: 618797799} - component: {fileID: 618797799}
m_Layer: 5 m_Layer: 5
m_Name: Interaction Prompt Overlay m_Name: Heads Up Display
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
@ -7656,7 +7794,7 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
m_PanelSettings: {fileID: 11400000, guid: 21896e34ffd76694aa03bd08a51762a9, type: 2} m_PanelSettings: {fileID: 11400000, guid: 21896e34ffd76694aa03bd08a51762a9, type: 2}
m_ParentUI: {fileID: 0} m_ParentUI: {fileID: 0}
sourceAsset: {fileID: 9197481963319205126, guid: 5ecae982f651ff6438bbaa95ba0362e1, sourceAsset: {fileID: 9197481963319205126, guid: 61a631e3bab018249a7b4e91108bfde2,
type: 3} type: 3}
m_SortingOrder: 0 m_SortingOrder: 0
--- !u!4 &618797800 --- !u!4 &618797800
@ -7839,7 +7977,7 @@ Mesh:
offset: 0 offset: 0
size: 0 size: 0
path: path:
--- !u!1 &917153437 --- !u!1 &785883830
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
@ -7847,48 +7985,61 @@ GameObject:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
serializedVersion: 6 serializedVersion: 6
m_Component: m_Component:
- component: {fileID: 917153439} - component: {fileID: 785883831}
- component: {fileID: 917153438} - component: {fileID: 785883832}
- component: {fileID: 785883833}
m_Layer: 0 m_Layer: 0
m_Name: Audio Manager m_Name: Options Screen
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 1 m_IsActive: 0
--- !u!114 &917153438 --- !u!4 &785883831
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 917153437}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 723a7675db014cb3aca02f49d069e931, type: 3}
m_Name:
m_EditorClassIdentifier:
musicSource: {fileID: 0}
musicSourceDefaultVolume: 0.6
sfxSource: {fileID: 0}
sfxSourceDefaultVolume: 0.6
menuButtonClick: {fileID: 0}
menuButtonHover: {fileID: 0}
--- !u!4 &917153439
Transform: Transform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 917153437} m_GameObject: {fileID: 785883830}
serializedVersion: 2 serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -16.463919, y: 4.84284, z: -19.970129} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 1798850120}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &785883832
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 785883830}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 19102, guid: 0000000000000000e000000000000000, type: 0}
m_Name:
m_EditorClassIdentifier:
m_PanelSettings: {fileID: 11400000, guid: 21896e34ffd76694aa03bd08a51762a9, type: 2}
m_ParentUI: {fileID: 0}
sourceAsset: {fileID: 9197481963319205126, guid: 5eba6600eb918b44abae54cd21582a4b,
type: 3}
m_SortingOrder: 0
--- !u!114 &785883833
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 785883830}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 81b14085a75c30f4fb71c2f8c4429547, type: 3}
m_Name:
m_EditorClassIdentifier:
associatedState: 2
--- !u!1 &1006498776 --- !u!1 &1006498776
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -9689,6 +9840,55 @@ Transform:
m_Children: [] m_Children: []
m_Father: {fileID: 1060921176} m_Father: {fileID: 1060921176}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1226619922
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1226619923}
- component: {fileID: 1226619924}
m_Layer: 5
m_Name: Interaction Prompt Overlay
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!4 &1226619923
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1226619922}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 16.463919, y: -4.84284, z: 19.970129}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1798850120}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1226619924
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1226619922}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 19102, guid: 0000000000000000e000000000000000, type: 0}
m_Name:
m_EditorClassIdentifier:
m_PanelSettings: {fileID: 11400000, guid: 21896e34ffd76694aa03bd08a51762a9, type: 2}
m_ParentUI: {fileID: 0}
sourceAsset: {fileID: 9197481963319205126, guid: 5ecae982f651ff6438bbaa95ba0362e1,
type: 3}
m_SortingOrder: 0
--- !u!43 &1251389302 --- !u!43 &1251389302
Mesh: Mesh:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -11177,6 +11377,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 9f6e55d96ef14d65979aabb99a0d5f1a, type: 3} m_Script: {fileID: 11500000, guid: 9f6e55d96ef14d65979aabb99a0d5f1a, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
headsUpDisplay: {fileID: 618797798}
--- !u!4 &1766444915 --- !u!4 &1766444915
Transform: Transform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -11569,6 +11770,7 @@ GameObject:
m_Component: m_Component:
- component: {fileID: 1794617895} - component: {fileID: 1794617895}
- component: {fileID: 1794617896} - component: {fileID: 1794617896}
- component: {fileID: 1794617897}
m_Layer: 0 m_Layer: 0
m_Name: Main Menu Screen m_Name: Main Menu Screen
m_TagString: Untagged m_TagString: Untagged
@ -11608,6 +11810,19 @@ MonoBehaviour:
sourceAsset: {fileID: 9197481963319205126, guid: 2054bc5e9ca6dd940a012c27265f7d43, sourceAsset: {fileID: 9197481963319205126, guid: 2054bc5e9ca6dd940a012c27265f7d43,
type: 3} type: 3}
m_SortingOrder: 0 m_SortingOrder: 0
--- !u!114 &1794617897
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1794617894}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f7d3d52857e7418c805c0237b4c86485, type: 3}
m_Name:
m_EditorClassIdentifier:
associatedState: 1
--- !u!1 &1798850119 --- !u!1 &1798850119
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -11619,7 +11834,7 @@ GameObject:
- component: {fileID: 1798850120} - component: {fileID: 1798850120}
m_Layer: 0 m_Layer: 0
m_Name: Interfaces m_Name: Interfaces
m_TagString: Untagged m_TagString: Interfaces
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
@ -11638,7 +11853,9 @@ Transform:
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 618797800} - {fileID: 618797800}
- {fileID: 1226619923}
- {fileID: 1794617895} - {fileID: 1794617895}
- {fileID: 785883831}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1805235905 --- !u!1 &1805235905
@ -12345,8 +12562,8 @@ SceneRoots:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_Roots: m_Roots:
- {fileID: 1766444915} - {fileID: 1766444915}
- {fileID: 917153439}
- {fileID: 1798850120} - {fileID: 1798850120}
- {fileID: 438254297}
- {fileID: 567431775} - {fileID: 567431775}
- {fileID: 1656492132} - {fileID: 1656492132}
- {fileID: 1120089} - {fileID: 1120089}

View file

@ -4,7 +4,9 @@
* description: game manager singleton for a single source of truth state management * description: game manager singleton for a single source of truth state management
*/ */
using System;
using UnityEngine; using UnityEngine;
using UnityEngine.InputSystem;
/// <summary> /// <summary>
/// singleton class for managing the game state as a single source of truth /// singleton class for managing the game state as a single source of truth
@ -17,11 +19,11 @@ public class GameManager : MonoBehaviour
public enum DisplayState public enum DisplayState
{ {
Game, Game,
ScreenMainMenu, // done ScreenMainMenu,
ScreenOptionsMenu, // done ScreenOptionsMenu,
OverlayPauseMenu, // TODO OverlayPauseMenu,
OverlayCompleteUnderTimeMenu, // TODO OverlayCompleteUnderTimeMenu,
OverlayFailedOverTimeMenu, // TODO OverlayFailedOverTimeMenu,
UnassociatedState UnassociatedState
} }
@ -30,6 +32,11 @@ public enum DisplayState
/// </summary> /// </summary>
public static GameManager Instance; public static GameManager Instance;
/// <summary>
/// property to store the heads-up display game object
/// </summary>
[SerializeField] private GameObject headsUpDisplay;
/// <summary> /// <summary>
/// the current state of the game /// the current state of the game
/// </summary> /// </summary>
@ -40,9 +47,11 @@ public enum DisplayState
/// </summary> /// </summary>
public bool Paused => _state != DisplayState.Game; public bool Paused => _state != DisplayState.Game;
/// <summary> /// <summary>
/// function to set doesn't destroy on load and checks for multiple instances /// function to set doesn't destroy on load and checks for multiple instances
/// </summary> /// </summary>
/// <exception cref="NullReferenceException">thrown if a Heads-Up Display game object isn't set in the properties</exception>
private void Awake() private void Awake()
{ {
// check if instance hasn't been set yet // check if instance hasn't been set yet
@ -63,6 +72,10 @@ private void Awake()
// destroy the new instance if it's not the singleton instance // destroy the new instance if it's not the singleton instance
Destroy(gameObject); Destroy(gameObject);
} }
// check if the heads-up display is set
if (headsUpDisplay == null)
throw new NullReferenceException("GameManager: heads-up display is not set in game manager properties");
} }
/// <summary> /// <summary>
@ -71,7 +84,10 @@ private void Awake()
// /// <exception cref="Exception">generic exception it couldn't verify a safe state when starting the game</exception> // /// <exception cref="Exception">generic exception it couldn't verify a safe state when starting the game</exception>
private void Start() private void Start()
{ {
// set to the main menu state
SetDisplayState(DisplayState.ScreenMainMenu); SetDisplayState(DisplayState.ScreenMainMenu);
// pause the game
PauseGameHelper(DisplayState.ScreenMainMenu);
} }
/// <summary> /// <summary>
@ -113,6 +129,15 @@ private void PauseGameHelper(DisplayState incomingState)
Debug.Log("GameManager.PauseGameHelper: freeing cursor for main menu"); Debug.Log("GameManager.PauseGameHelper: freeing cursor for main menu");
Cursor.lockState = CursorLockMode.None; Cursor.lockState = CursorLockMode.None;
Cursor.visible = true; Cursor.visible = true;
Debug.Log(GameObject.FindGameObjectWithTag("Player"));
var playerInput = GameObject.Find("PlayerArmature")?.GetComponent<PlayerInput>();
Debug.Log($"playerController={playerInput}");
if (playerInput != null)
{
Debug.Log("GameManager.PauseGameHelper: sentencing player input/control to a ball and chain boowomp");
playerInput.enabled = false;
}
} }
// if the current and incoming states are the same, then we shouldn't do anything, // if the current and incoming states are the same, then we shouldn't do anything,
@ -126,9 +151,9 @@ private void PauseGameHelper(DisplayState incomingState)
// hide any menu that is currently showing // hide any menu that is currently showing
HideMenuHelper(); HideMenuHelper();
// get all child menus in the "Menus" parent object // get all child interfaces in the "Interfaces" parent object
foreach (var menuParent in GameObject.FindGameObjectsWithTag("Interfaces")) foreach (var interfaces in GameObject.FindGameObjectsWithTag("Interfaces"))
foreach (Transform menu in menuParent.transform) foreach (Transform menu in interfaces.transform)
{ {
// show the menu based on the incoming state // show the menu based on the incoming state
// get the associated state of the menu // get the associated state of the menu
@ -166,13 +191,19 @@ private void ResumeGameHelper(DisplayState incomingState)
} }
// else, we should resume the game // else, we should resume the game
Debug.Log("GameManager.ResumeGameHelper: resuming game");
Time.timeScale = 1f; Time.timeScale = 1f;
Cursor.lockState = CursorLockMode.Locked; Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = false; Cursor.visible = false;
Debug.Log("GameManager.ResumeGameHelper: resuming game");
// hide any menu that is currently showing // hide any menu that is currently showing
HideMenuHelper(); HideMenuHelper();
// free the character controller
var playerInput = GameObject.Find("PlayerArmature")?.GetComponent<PlayerInput>();
if (playerInput == null) return;
Debug.Log("GameManager.ResumeGameHelper: enabling player input/control");
playerInput.enabled = true;
} }
/// <summary> /// <summary>
@ -203,11 +234,23 @@ public void SetDisplayState(DisplayState displayState)
// if we're transitioning into gameplay or into the main menu, // if we're transitioning into gameplay or into the main menu,
// we'll need a post-step to enable the correct camera // we'll need a post-step to enable the correct camera
if (displayState is not (DisplayState.Game or DisplayState.ScreenMainMenu)) if (displayState is not (DisplayState.Game or DisplayState.ScreenMainMenu))
{
Debug.Log($"GameManager.SetDisplayState({displayState}): skipping post-step");
return; return;
}
// get all MainCamera-tagged objects and disable them // disabling (1): disable the 'Menu Camera' camera
var menuCameraObject = GameObject.Find("Menu Camera")?.GetComponent<Camera>();
if (menuCameraObject != null)
{
Debug.Log("GameManager.SetDisplayState: disabling 'Menu Camera' camera");
menuCameraObject.enabled = false;
}
// disabling (2): get all MainCamera-tagged objects and disable them
foreach (var mainCameraObject in GameObject.FindGameObjectsWithTag("MainCamera")) foreach (var mainCameraObject in GameObject.FindGameObjectsWithTag("MainCamera"))
{ {
Debug.Log($"GameManager.SetDisplayState: disabling 'MainCamera' camera {mainCameraObject}");
// find the camera component // find the camera component
var potentialCamera = mainCameraObject.GetComponent<Camera>(); var potentialCamera = mainCameraObject.GetComponent<Camera>();
// if the object doesn't have a camera component, skip it // if the object doesn't have a camera component, skip it
@ -224,7 +267,7 @@ public void SetDisplayState(DisplayState displayState)
switch (displayState) switch (displayState)
{ {
// if we're transitioning to the main menu state, // if we're transitioning to the main menu state,
// change the camera to the main menu camera under the "Menus"-tagged parent object // change the camera to the main menu camera named very specifically such
case DisplayState.ScreenMainMenu: case DisplayState.ScreenMainMenu:
Debug.Log("GameManager.SetDisplayState: targeting 'Menu Camera' camera"); Debug.Log("GameManager.SetDisplayState: targeting 'Menu Camera' camera");
targetCameraObject = GameObject.Find("Menu Camera"); targetCameraObject = GameObject.Find("Menu Camera");
@ -237,14 +280,11 @@ public void SetDisplayState(DisplayState displayState)
break; break;
} }
// find the camera component // find the camera component and enable it
if (targetCameraObject == null) return; var targetCamera = targetCameraObject?.GetComponent<Camera>();
var targetCamera = targetCameraObject.GetComponent<Camera>();
if (targetCamera == null) return; if (targetCamera == null) return;
// enable the target camera
Debug.Log("GameManager.SetDisplayState: enabling target camera");
targetCamera.enabled = true; targetCamera.enabled = true;
Debug.Log("GameManager.SetDisplayState: enabled target camera");
} }
/// <summary> /// <summary>

View file

@ -59,7 +59,7 @@ public override void OnEnable()
/// </summary> /// </summary>
private void OptionStartGame() private void OptionStartGame()
{ {
// start game Debug.Log("ScreenMainMenu.OptionStartGame: clicked, starting game");
Game.NewGame(); Game.NewGame();
} }
@ -69,7 +69,7 @@ private void OptionStartGame()
/// </summary> /// </summary>
private void OptionShowOptions() private void OptionShowOptions()
{ {
// show the option menu Debug.Log("ScreenMainMenu.OptionShowOptions: clicked, showing options menu");
Game.SetDisplayState(GameManager.DisplayState.ScreenOptionsMenu); Game.SetDisplayState(GameManager.DisplayState.ScreenOptionsMenu);
} }
@ -79,8 +79,7 @@ private void OptionShowOptions()
/// </summary> /// </summary>
private void OptionQuitGame() private void OptionQuitGame()
{ {
// quit game Debug.Log("ScreenMainMenu.OptionQuitGame: clicked, quitting game");
Debug.Log("MainMenu.OptionQuitGame: exiting");
Game.Quit(); Game.Quit();
} }
} }

View file

@ -5,7 +5,6 @@ #Root {
Button { Button {
background-color: rgb(193, 39, 45); background-color: rgb(193, 39, 45);
width: 40%;
height: 25%; height: 25%;
color: rgb(255, 255, 255); color: rgb(255, 255, 255);
font-size: 24px; font-size: 24px;
@ -19,4 +18,13 @@ Button {
border-right-color: rgba(0, 0, 0, 0); border-right-color: rgba(0, 0, 0, 0);
border-top-color: rgba(0, 0, 0, 0); border-top-color: rgba(0, 0, 0, 0);
border-bottom-color: rgba(0, 0, 0, 0); border-bottom-color: rgba(0, 0, 0, 0);
min-width: 40%;
}
Slider {
color: rgb(193, 39, 45);
font-size: 24px;
}
Slider > VisualElemement {
} }

View file

@ -1,8 +1,9 @@
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" editor-extension-mode="False"> <ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" editor-extension-mode="False">
<Style src="project://database/Assets/UI%20Toolkit/Interfaces/Common.uss?fileID=7433441132597879392&amp;guid=7e22eeee55627cf478c5e125a8197039&amp;type=3#Common" />
<ui:VisualElement name="Root" style="flex-grow: 1; justify-content: space-around; align-items: center;"> <ui:VisualElement name="Root" style="flex-grow: 1; justify-content: space-around; align-items: center;">
<ui:VisualElement name="VertHolder" style="flex-grow: 1; justify-content: flex-start; align-items: center; align-self: auto; margin-top: 2%;"> <ui:VisualElement name="VertHolder" style="flex-grow: 1; justify-content: flex-start; align-items: center; align-self: auto; margin-top: 2%;">
<ui:Label tabindex="-1" parse-escape-sequences="true" display-tooltip-when-elided="true" text="00:53.47" name="Stopwatch" style="color: rgb(255, 255, 255); -unity-text-align: upper-center; white-space: normal; -unity-font: url(&quot;project://database/Assets/UI%20Toolkit/RLFonts/Fervojo/Fervojo-Bold.otf?fileID=12800000&amp;guid=505dfbc18d2d4604db47ff55755f9dc8&amp;type=3#Fervojo-Bold&quot;); -unity-font-definition: url(&quot;project://database/Assets/UI%20Toolkit/RLFonts/Fervojo/Fervojo-Bold%20SDF.asset?fileID=11400000&amp;guid=1abb65c0bf74b1649863fc75b2b83ac1&amp;type=2#Fervojo-Bold SDF&quot;); font-size: 32px; margin-bottom: 0; padding-bottom: 0;" /> <ui:Label tabindex="-1" parse-escape-sequences="true" display-tooltip-when-elided="true" text="00:53.47" name="Stopwatch" style="color: rgb(255, 255, 255); -unity-text-align: upper-center; white-space: normal; -unity-font: url(&quot;project://database/Assets/UI%20Toolkit/RLFonts/Fervojo/Fervojo-Bold.otf?fileID=12800000&amp;guid=505dfbc18d2d4604db47ff55755f9dc8&amp;type=3#Fervojo-Bold&quot;); -unity-font-definition: url(&quot;project://database/Assets/UI%20Toolkit/RLFonts/Fervojo/Fervojo-Bold%20SDF.asset?fileID=11400000&amp;guid=1abb65c0bf74b1649863fc75b2b83ac1&amp;type=2#Fervojo-Bold SDF&quot;); font-size: 64px; margin-bottom: 0; padding-bottom: 0;" />
<ui:Label tabindex="-1" parse-escape-sequences="true" display-tooltip-when-elided="true" text="00:53.47" name="Score" style="color: rgb(255, 255, 255); -unity-text-align: upper-center; white-space: normal; -unity-font: url(&quot;project://database/Assets/UI%20Toolkit/RLFonts/Fervojo/Fervojo-Bold.otf?fileID=12800000&amp;guid=505dfbc18d2d4604db47ff55755f9dc8&amp;type=3#Fervojo-Bold&quot;); -unity-font-definition: url(&quot;project://database/Assets/UI%20Toolkit/RLFonts/Fervojo/Fervojo-Bold%20SDF.asset?fileID=11400000&amp;guid=1abb65c0bf74b1649863fc75b2b83ac1&amp;type=2#Fervojo-Bold SDF&quot;); font-size: 14px; margin-top: 0; padding-top: 0;" /> <ui:Label tabindex="-1" parse-escape-sequences="true" display-tooltip-when-elided="true" text="1,000" name="Score" style="color: rgb(255, 255, 255); -unity-text-align: upper-center; white-space: normal; -unity-font: url(&quot;project://database/Assets/UI%20Toolkit/RLFonts/Fervojo/Fervojo-Bold.otf?fileID=12800000&amp;guid=505dfbc18d2d4604db47ff55755f9dc8&amp;type=3#Fervojo-Bold&quot;); -unity-font-definition: url(&quot;project://database/Assets/UI%20Toolkit/RLFonts/Fervojo/Fervojo-Bold%20SDF.asset?fileID=11400000&amp;guid=1abb65c0bf74b1649863fc75b2b83ac1&amp;type=2#Fervojo-Bold SDF&quot;); font-size: 32px; margin-top: 0; padding-top: 0;" />
</ui:VisualElement> </ui:VisualElement>
</ui:VisualElement> </ui:VisualElement>
</ui:UXML> </ui:UXML>

View file

@ -1,7 +1,7 @@
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" editor-extension-mode="False"> <ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" editor-extension-mode="False">
<ui:VisualElement name="Root" style="flex-grow: 1; justify-content: space-around; align-items: center;"> <ui:VisualElement name="Root" style="flex-grow: 1; justify-content: space-around; align-items: center;">
<ui:VisualElement name="VertHolder" style="flex-grow: 1; justify-content: center; margin-top: 25%;"> <ui:VisualElement name="VertHolder" style="flex-grow: 1; justify-content: center; margin-top: 30%;">
<ui:Label tabindex="-1" parse-escape-sequences="true" display-tooltip-when-elided="true" text="Press E to Interact" name="PromptLabel" style="background-color: rgba(0, 0, 0, 0.33); color: rgb(255, 255, 255); -unity-text-align: upper-center; padding-right: 8px; padding-left: 8px; padding-top: 8px; padding-bottom: 8px; border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; white-space: normal; -unity-font: url(&quot;project://database/Assets/UI%20Toolkit/RLFonts/Fervojo/Fervojo-Medium.otf?fileID=12800000&amp;guid=9439a6fdc5392c6479cda7dd72a8f3f7&amp;type=3#Fervojo-Medium&quot;); -unity-font-definition: url(&quot;project://database/Assets/UI%20Toolkit/RLFonts/Fervojo/Fervojo-Medium%20SDF.asset?fileID=11400000&amp;guid=45943718062c86e448361bd7f6506932&amp;type=2#Fervojo-Medium SDF&quot;);" /> <ui:Label tabindex="-1" parse-escape-sequences="true" display-tooltip-when-elided="true" text="Press E to Interact" name="PromptLabel" style="background-color: rgba(0, 0, 0, 0.33); color: rgb(255, 255, 255); -unity-text-align: upper-center; padding-right: 8px; padding-left: 8px; padding-top: 8px; padding-bottom: 8px; border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; white-space: normal; -unity-font: url(&quot;project://database/Assets/UI%20Toolkit/RLFonts/Fervojo/Fervojo-Medium.otf?fileID=12800000&amp;guid=9439a6fdc5392c6479cda7dd72a8f3f7&amp;type=3#Fervojo-Medium&quot;); -unity-font-definition: url(&quot;project://database/Assets/UI%20Toolkit/RLFonts/Fervojo/Fervojo-Medium%20SDF.asset?fileID=11400000&amp;guid=45943718062c86e448361bd7f6506932&amp;type=2#Fervojo-Medium SDF&quot;); font-size: 28px;" />
</ui:VisualElement> </ui:VisualElement>
</ui:VisualElement> </ui:VisualElement>
</ui:UXML> </ui:UXML>

View file

@ -0,0 +1,13 @@
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="False">
<Style src="project://database/Assets/UI%20Toolkit/Interfaces/Common.uss?fileID=7433441132597879392&amp;guid=7e22eeee55627cf478c5e125a8197039&amp;type=3#Common" />
<ui:VisualElement name="Root" style="flex-grow: 1; justify-content: space-around; align-items: stretch; align-self: stretch; width: auto;">
<ui:VisualElement name="HoriHolder" style="flex-grow: 1; flex-direction: column; max-height: 60%; margin-left: 10%; margin-right: 10%;">
<ui:VisualElement name="Logospace" style="flex-grow: 1; width: auto; flex-direction: row; padding-bottom: 6%; height: 50%; min-height: 50%;" />
<ui:VisualElement name="Buttonspace" style="flex-grow: 1; width: 50%; min-width: 50%; height: 50%; min-height: 50%; align-items: center; justify-content: flex-end; align-self: center;">
<ui:Slider label="Music" high-value="100" name="Music" style="justify-content: space-around; align-items: stretch; align-self: stretch;" />
<ui:Slider label="Effects" high-value="100" name="SFX" style="align-self: stretch; padding-bottom: 0; margin-bottom: 10%; justify-content: space-around;" />
<ui:Button text="Return" parse-escape-sequences="true" display-tooltip-when-elided="true" name="ButtonReturn" />
</ui:VisualElement>
</ui:VisualElement>
</ui:VisualElement>
</ui:UXML>

View file

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 5eba6600eb918b44abae54cd21582a4b
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}

View file

@ -99,7 +99,7 @@
{ {
"type": "System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", "type": "System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
"key": "ShapeBuilder.ActiveShapeIndex", "key": "ShapeBuilder.ActiveShapeIndex",
"value": "{\"m_Value\":1}" "value": "{\"m_Value\":2}"
}, },
{ {
"type": "System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", "type": "System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
@ -119,7 +119,7 @@
{ {
"type": "UnityEngine.Vector3, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "type": "UnityEngine.Vector3, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"key": "ShapeBuilder.LastSize", "key": "ShapeBuilder.LastSize",
"value": "{\"m_Value\":{\"x\":-32.693790435791019,\"y\":0.0,\"z\":19.31177520751953}}" "value": "{\"m_Value\":{\"x\":-2.3972702026367189,\"y\":6.764400482177734,\"z\":2.3311424255371095}}"
}, },
{ {
"type": "UnityEngine.Quaternion, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "type": "UnityEngine.Quaternion, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
@ -165,6 +165,11 @@
"type": "UnityEngine.ProBuilder.Shapes.Shape, Unity.ProBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "type": "UnityEngine.ProBuilder.Shapes.Shape, Unity.ProBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"key": "ShapeBuilder.Cube", "key": "ShapeBuilder.Cube",
"value": "{}" "value": "{}"
},
{
"type": "UnityEngine.ProBuilder.Shapes.Shape, Unity.ProBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"key": "ShapeBuilder.Cone",
"value": "{}"
} }
] ]
} }