From ecda05da0486be98c77741576dcb7749d90b9788 Mon Sep 17 00:00:00 2001 From: Jan Date: Sun, 22 Apr 2018 00:22:56 +0200 Subject: [PATCH] add gameover UI --- Assets/Prefabs/GameOverUI.prefab | 14 +- Assets/Prefabs/Player.prefab | 2 +- Assets/Prefabs/StartingRoom.prefab | 682 ++++++++++++++++++++++++++++- Assets/Scenes/CodeDEV.unity | 6 + Assets/Scenes/UITestingScene.unity | 75 +++- Assets/Scripts/Entities/Player.cs | 1 + Assets/Scripts/GameController.cs | 14 +- Assets/Scripts/UIController.cs | 31 +- 8 files changed, 802 insertions(+), 23 deletions(-) diff --git a/Assets/Prefabs/GameOverUI.prefab b/Assets/Prefabs/GameOverUI.prefab index 21647c8..786fcbc 100644 --- a/Assets/Prefabs/GameOverUI.prefab +++ b/Assets/Prefabs/GameOverUI.prefab @@ -228,7 +228,7 @@ MonoBehaviour: m_OnClick: m_PersistentCalls: m_Calls: - - m_Target: {fileID: 114967690270100428} + - m_Target: {fileID: 0} m_MethodName: LoadSceneByIndex m_Mode: 3 m_Arguments: @@ -312,6 +312,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 4f52f2b666c1ec64195aad9936df2d4f, type: 3} m_Name: m_EditorClassIdentifier: + gameOverPanel: {fileID: 0} --- !u!114 &114489994643492222 MonoBehaviour: m_ObjectHideFlags: 1 @@ -367,7 +368,7 @@ MonoBehaviour: m_OnClick: m_PersistentCalls: m_Calls: - - m_Target: {fileID: 114438549158160292} + - m_Target: {fileID: 0} m_MethodName: LoadSceneByIndex m_Mode: 3 m_Arguments: @@ -478,6 +479,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 4f52f2b666c1ec64195aad9936df2d4f, type: 3} m_Name: m_EditorClassIdentifier: + gameOverPanel: {fileID: 0} --- !u!222 &222125008505892984 CanvasRenderer: m_ObjectHideFlags: 1 @@ -520,7 +522,7 @@ Canvas: m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} m_GameObject: {fileID: 1215705942152504} - m_Enabled: 1 + m_Enabled: 0 serializedVersion: 3 m_RenderMode: 0 m_Camera: {fileID: 0} @@ -540,8 +542,8 @@ RectTransform: m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} m_GameObject: {fileID: 1215705942152504} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 5.7722692} m_LocalScale: {x: 0, y: 0, z: 0} m_Children: - {fileID: 224485597474865234} @@ -550,7 +552,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 0, y: 0} + m_AnchoredPosition: {x: 0.71587634, y: -2.9267945} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0, y: 0} --- !u!224 &224089457197639100 diff --git a/Assets/Prefabs/Player.prefab b/Assets/Prefabs/Player.prefab index 7c0c159..7474892 100644 --- a/Assets/Prefabs/Player.prefab +++ b/Assets/Prefabs/Player.prefab @@ -118,7 +118,7 @@ Rigidbody2D: m_AngularDrag: 0 m_GravityScale: 0 m_Material: {fileID: 0} - m_Interpolate: 0 + m_Interpolate: 1 m_SleepingMode: 1 m_CollisionDetection: 0 m_Constraints: 0 diff --git a/Assets/Prefabs/StartingRoom.prefab b/Assets/Prefabs/StartingRoom.prefab index 00469d1..cc78d15 100644 --- a/Assets/Prefabs/StartingRoom.prefab +++ b/Assets/Prefabs/StartingRoom.prefab @@ -128,6 +128,22 @@ GameObject: m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 +--- !u!1 &1351683204958220 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 4462458468062846} + - component: {fileID: 114099750246022788} + m_Layer: 0 + m_Name: UI + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 --- !u!1 &1376851329299758 GameObject: m_ObjectHideFlags: 1 @@ -160,6 +176,23 @@ GameObject: m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 +--- !u!1 &1520529637691086 +GameObject: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 224836839404105470} + - component: {fileID: 222755623670923622} + - component: {fileID: 114224215426430834} + m_Layer: 5 + m_Name: GameOverPanel + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 --- !u!1 &1528048736566048 GameObject: m_ObjectHideFlags: 1 @@ -190,6 +223,41 @@ GameObject: m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 +--- !u!1 &1587391972954994 +GameObject: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 224233305826671714} + - component: {fileID: 222222624144346104} + - component: {fileID: 114361498570700282} + m_Layer: 5 + m_Name: Restart + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &1588020430739812 +GameObject: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 224008462890170856} + - component: {fileID: 222068304746906226} + - component: {fileID: 114326991209390230} + - component: {fileID: 114190107569556832} + m_Layer: 5 + m_Name: MainMenuButton + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 --- !u!1 &1686504243753214 GameObject: m_ObjectHideFlags: 1 @@ -206,6 +274,41 @@ GameObject: m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 +--- !u!1 &1693582626949408 +GameObject: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 224946030744724768} + - component: {fileID: 222161923737867198} + - component: {fileID: 114750612526984012} + m_Layer: 5 + m_Name: MainMenu + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &1717091555531044 +GameObject: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 224275328435346642} + - component: {fileID: 222503229185049354} + - component: {fileID: 114275580674196496} + - component: {fileID: 114198820678824316} + m_Layer: 5 + m_Name: RestartButton + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 --- !u!1 &1844252952274974 GameObject: m_ObjectHideFlags: 0 @@ -221,6 +324,41 @@ GameObject: m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 +--- !u!1 &1933520910381594 +GameObject: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 224085535815819546} + - component: {fileID: 223623737741762094} + - component: {fileID: 114758934128435388} + - component: {fileID: 114609813148612774} + m_Layer: 5 + m_Name: GameOverUI + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &1991707862972982 +GameObject: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 224964886476053868} + - component: {fileID: 222178938045658682} + - component: {fileID: 114615737672540240} + m_Layer: 5 + m_Name: GameOver + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 --- !u!4 &4254889038956124 Transform: m_ObjectHideFlags: 1 @@ -233,7 +371,7 @@ Transform: m_Children: - {fileID: 4615890080890712} m_Father: {fileID: 4524829645232432} - m_RootOrder: 1 + m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!4 &4405955685927858 Transform: @@ -247,7 +385,7 @@ Transform: m_Children: - {fileID: 4871197587417858} m_Father: {fileID: 4524829645232432} - m_RootOrder: 0 + m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!4 &4433182163931000 Transform: @@ -261,7 +399,7 @@ Transform: m_Children: - {fileID: 4896748037289080} m_Father: {fileID: 4524829645232432} - m_RootOrder: 2 + m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!4 &4443867424783896 Transform: @@ -276,6 +414,20 @@ Transform: m_Father: {fileID: 4896145802546722} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!4 &4462458468062846 +Transform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1351683204958220} + 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_Children: + - {fileID: 224085535815819546} + m_Father: {fileID: 4524829645232432} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!4 &4524829645232432 Transform: m_ObjectHideFlags: 1 @@ -286,6 +438,7 @@ Transform: m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: + - {fileID: 4462458468062846} - {fileID: 4405955685927858} - {fileID: 4254889038956124} - {fileID: 4433182163931000} @@ -347,7 +500,7 @@ Transform: - {fileID: 4958236485783856} - {fileID: 4921656537269078} m_Father: {fileID: 4524829645232432} - m_RootOrder: 3 + m_RootOrder: 4 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!4 &4896748037289080 Transform: @@ -577,6 +730,285 @@ BoxCollider2D: serializedVersion: 2 m_Size: {x: 10, y: 10} m_EdgeRadius: 0 +--- !u!114 &114099750246022788 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1351683204958220} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4f52f2b666c1ec64195aad9936df2d4f, type: 3} + m_Name: + m_EditorClassIdentifier: + gameOverPanel: {fileID: 1933520910381594} +--- !u!114 &114190107569556832 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1588020430739812} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1392445389, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 114326991209390230} + m_OnClick: + m_PersistentCalls: + m_Calls: + - m_Target: {fileID: 114099750246022788} + m_MethodName: LoadSceneByIndex + m_Mode: 3 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 + m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0, + Culture=neutral, PublicKeyToken=null +--- !u!114 &114198820678824316 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1717091555531044} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1392445389, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 1, g: 0.19339621, b: 0.19339621, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 114275580674196496} + m_OnClick: + m_PersistentCalls: + m_Calls: + - m_Target: {fileID: 114099750246022788} + m_MethodName: LoadSceneByIndex + m_Mode: 3 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 1 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 + m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0, + Culture=neutral, PublicKeyToken=null +--- !u!114 &114224215426430834 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1520529637691086} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 0.392} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!114 &114275580674196496 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1717091555531044} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!114 &114326991209390230 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1588020430739812} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!114 &114361498570700282 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1587391972954994} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Restart +--- !u!114 &114609813148612774 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1933520910381594} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1301386320, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreReversedGraphics: 1 + m_BlockingObjects: 0 + m_BlockingMask: + serializedVersion: 2 + m_Bits: 4294967295 +--- !u!114 &114615737672540240 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1991707862972982} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 100 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 1 + m_MaxSize: 100 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 1 + m_VerticalOverflow: 1 + m_LineSpacing: 1 + m_Text: Game Over --- !u!114 &114620228456935526 MonoBehaviour: m_ObjectHideFlags: 1 @@ -588,6 +1020,60 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 8b8cc30ac6e59724bba6536a17fbf027, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!114 &114750612526984012 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1693582626949408} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Return to main menu +--- !u!114 &114758934128435388 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1933520910381594} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1980459831, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UiScaleMode: 0 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 800, y: 600} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 --- !u!114 &114795477922050694 MonoBehaviour: m_ObjectHideFlags: 1 @@ -873,3 +1359,191 @@ SpriteRenderer: m_SpriteTileMode: 0 m_WasSpriteAssigned: 1 m_MaskInteraction: 0 +--- !u!222 &222068304746906226 +CanvasRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1588020430739812} +--- !u!222 &222161923737867198 +CanvasRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1693582626949408} +--- !u!222 &222178938045658682 +CanvasRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1991707862972982} +--- !u!222 &222222624144346104 +CanvasRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1587391972954994} +--- !u!222 &222503229185049354 +CanvasRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1717091555531044} +--- !u!222 &222755623670923622 +CanvasRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1520529637691086} +--- !u!223 &223623737741762094 +Canvas: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1933520910381594} + m_Enabled: 0 + serializedVersion: 3 + m_RenderMode: 0 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_AdditionalShaderChannelsFlag: 0 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 +--- !u!224 &224008462890170856 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1588020430739812} + 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_Children: + - {fileID: 224946030744724768} + m_Father: {fileID: 224836839404105470} + m_RootOrder: 2 + 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: -30} + m_SizeDelta: {x: 200, y: 50} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!224 &224085535815819546 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1933520910381594} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0, y: 0, z: 0} + m_Children: + - {fileID: 224836839404105470} + m_Father: {fileID: 4462458468062846} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 0} +--- !u!224 &224233305826671714 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1587391972954994} + 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_Children: [] + m_Father: {fileID: 224275328435346642} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!224 &224275328435346642 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1717091555531044} + 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_Children: + - {fileID: 224233305826671714} + m_Father: {fileID: 224836839404105470} + m_RootOrder: 1 + 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: 54} + m_SizeDelta: {x: 200, y: 50} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!224 &224836839404105470 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1520529637691086} + 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_Children: + - {fileID: 224964886476053868} + - {fileID: 224275328435346642} + - {fileID: 224008462890170856} + m_Father: {fileID: 224085535815819546} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!224 &224946030744724768 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1693582626949408} + 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_Children: [] + m_Father: {fileID: 224008462890170856} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!224 &224964886476053868 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1991707862972982} + 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_Children: [] + m_Father: {fileID: 224836839404105470} + m_RootOrder: 0 + 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: 185} + m_SizeDelta: {x: 600, y: 100} + m_Pivot: {x: 0.5, y: 0.5} diff --git a/Assets/Scenes/CodeDEV.unity b/Assets/Scenes/CodeDEV.unity index 1f14123..a98d42c 100644 --- a/Assets/Scenes/CodeDEV.unity +++ b/Assets/Scenes/CodeDEV.unity @@ -242,6 +242,11 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1487324256 stripped +GameObject: + m_PrefabParentObject: {fileID: 1351683204958220, guid: 212457bb2a8fabb44b1000b6d61dde66, + type: 2} + m_PrefabInternal: {fileID: 262279528} --- !u!1 &2063368131 GameObject: m_ObjectHideFlags: 0 @@ -285,3 +290,4 @@ MonoBehaviour: playerPrefab: {fileID: 1679161327080020, guid: 3d1911457c1e44f53b6b4044334db52f, type: 2} start: {fileID: 766094370} + ui: {fileID: 1487324256} diff --git a/Assets/Scenes/UITestingScene.unity b/Assets/Scenes/UITestingScene.unity index 3f06e95..2e84e37 100644 --- a/Assets/Scenes/UITestingScene.unity +++ b/Assets/Scenes/UITestingScene.unity @@ -118,7 +118,7 @@ Prefab: m_ObjectHideFlags: 0 serializedVersion: 2 m_Modification: - m_TransformParent: {fileID: 0} + m_TransformParent: {fileID: 1811007218} m_Modifications: - target: {fileID: 224057024608915776, guid: e280df50406ea4885b47be562c841df8, type: 2} @@ -158,7 +158,7 @@ Prefab: - target: {fileID: 224057024608915776, guid: e280df50406ea4885b47be562c841df8, type: 2} propertyPath: m_RootOrder - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 224057024608915776, guid: e280df50406ea4885b47be562c841df8, type: 2} @@ -210,9 +210,38 @@ Prefab: propertyPath: m_Pivot.y value: 0 objectReference: {fileID: 0} + - target: {fileID: 114168276631914824, guid: e280df50406ea4885b47be562c841df8, + type: 2} + propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Target + value: + objectReference: {fileID: 1811007217} + - target: {fileID: 114676373775701382, guid: e280df50406ea4885b47be562c841df8, + type: 2} + propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Target + value: + objectReference: {fileID: 1811007217} + - target: {fileID: 223374994783551110, guid: e280df50406ea4885b47be562c841df8, + type: 2} + propertyPath: m_Enabled + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1215705942152504, guid: e280df50406ea4885b47be562c841df8, type: 2} + propertyPath: m_IsActive + value: 1 + objectReference: {fileID: 0} m_RemovedComponents: [] m_ParentPrefab: {fileID: 100100000, guid: e280df50406ea4885b47be562c841df8, type: 2} m_IsPrefabParent: 0 +--- !u!1 &488206694 stripped +GameObject: + m_PrefabParentObject: {fileID: 1291961859191516, guid: e280df50406ea4885b47be562c841df8, + type: 2} + m_PrefabInternal: {fileID: 488206693} +--- !u!224 &488206695 stripped +RectTransform: + m_PrefabParentObject: {fileID: 224057024608915776, guid: e280df50406ea4885b47be562c841df8, + type: 2} + m_PrefabInternal: {fileID: 488206693} --- !u!1 &829597088 GameObject: m_ObjectHideFlags: 0 @@ -354,5 +383,47 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1811007216 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1811007218} + - component: {fileID: 1811007217} + m_Layer: 0 + m_Name: UI + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1811007217 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1811007216} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4f52f2b666c1ec64195aad9936df2d4f, type: 3} + m_Name: + m_EditorClassIdentifier: + gameOverPanel: {fileID: 488206694} +--- !u!4 &1811007218 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1811007216} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -0.71587634, y: 2.9267945, z: -5.7722692} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 488206695} + m_Father: {fileID: 0} m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/Assets/Scripts/Entities/Player.cs b/Assets/Scripts/Entities/Player.cs index 74d9968..316b26b 100644 --- a/Assets/Scripts/Entities/Player.cs +++ b/Assets/Scripts/Entities/Player.cs @@ -28,5 +28,6 @@ public class Player : Mob { { base.Kill(); Destroy(this.gameObject); + GameController.instance.ChangeState(GameController.GameState.ENDED); } } diff --git a/Assets/Scripts/GameController.cs b/Assets/Scripts/GameController.cs index ffd8047..1a4cd5c 100644 --- a/Assets/Scripts/GameController.cs +++ b/Assets/Scripts/GameController.cs @@ -11,6 +11,9 @@ public class GameController : MonoBehaviour { private Room start; private Room finish; + [SerializeField] + private GameObject ui; + private bool engineInitDone; public static GameController instance; @@ -38,7 +41,7 @@ public class GameController : MonoBehaviour { } } - void ChangeState(GameState nextState) { + public void ChangeState(GameState nextState) { if(nextState != state) { state = nextState; StateLogic(nextState); @@ -91,7 +94,14 @@ public class GameController : MonoBehaviour { private void Ended() { - + Debug.Log("Game ended"); + //Time.timeScale = 0; + if (ui != null) { + Debug.Log("show gameover UI"); + ui.GetComponent().ShowGameOverUI(); + } else { + Debug.Log("No ui specified"); + } } } diff --git a/Assets/Scripts/UIController.cs b/Assets/Scripts/UIController.cs index cb3d861..4bd1f99 100644 --- a/Assets/Scripts/UIController.cs +++ b/Assets/Scripts/UIController.cs @@ -3,14 +3,12 @@ using System.Collections.Generic; using UnityEngine; public class UIController : MonoBehaviour { - public UIController() - { - UIController.instance = this; - } - + private GameObject score; - private GameObject pauseMenu; - private GameObject GameOverPanel; + private GameObject pauseMenu; + + [SerializeField] + private GameObject gameOverPanel; // Use this for initialization void Start () { } @@ -30,13 +28,30 @@ public class UIController : MonoBehaviour { public void LoadSceneByIndex(int index) { + Debug.Log("Loaded scene " + index); UnityEngine.SceneManagement.SceneManager.LoadScene(index); } public void QuitGame() { + Debug.Log("Quit game"); Application.Quit(); + } + + public void ShowGameOverUI() { + if (gameOverPanel != null) { + Canvas gameOverCanvas = gameOverPanel.GetComponent(); + Debug.Log("Loading Canvas"); + + if (gameOverCanvas != null) { + Debug.Log("Loaded Canvas"); + gameOverCanvas.enabled = true; + } else { + Debug.Log("Gameover panel has no Canvas"); + } + } else { + Debug.Log("No game over panel assigned"); + } } - }