From 8c7ea4ff9f38d7af82c5ca3c2361151dbcede55e Mon Sep 17 00:00:00 2001 From: craftwill Date: Sun, 15 May 2022 13:02:35 -0400 Subject: [PATCH] HealtBars and Dimension1.prefab fix --- Assets/Prefabs/Canvas_UI.prefab | 652 +++++++++++++----- Assets/Prefabs/Dimension1/Dimension1.prefab | 135 +++- Assets/Prefabs/UI.meta | 8 + Assets/Prefabs/UI/HealthBar.prefab | 300 ++++++++ Assets/Prefabs/UI/HealthBar.prefab.meta | 7 + Assets/Scripts/DimensionController.cs | 2 +- Assets/Scripts/GameManager.cs | 26 +- .../Scripts/UI/HealthBar/ConjureUIElement.cs | 27 + .../UI/HealthBar/ConjureUIElement.cs.meta | 11 + Assets/Scripts/UI/HealthBar/HealthBar.cs | 15 +- Assets/Scripts/UIController.cs | 20 +- Assets/Scripts/WorldSwitcher.cs | 10 + 12 files changed, 1030 insertions(+), 183 deletions(-) create mode 100644 Assets/Prefabs/UI.meta create mode 100644 Assets/Prefabs/UI/HealthBar.prefab create mode 100644 Assets/Prefabs/UI/HealthBar.prefab.meta create mode 100644 Assets/Scripts/UI/HealthBar/ConjureUIElement.cs create mode 100644 Assets/Scripts/UI/HealthBar/ConjureUIElement.cs.meta diff --git a/Assets/Prefabs/Canvas_UI.prefab b/Assets/Prefabs/Canvas_UI.prefab index dc7ef80..be6553b 100644 --- a/Assets/Prefabs/Canvas_UI.prefab +++ b/Assets/Prefabs/Canvas_UI.prefab @@ -851,10 +851,12 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: - - {fileID: 3735044009610982792} - - {fileID: 2010045890940401534} + - {fileID: 1714364098846827564} - {fileID: 5616491715955234103} - {fileID: 7174851450076484861} + - {fileID: 7483763325311061105} + - {fileID: 7877029066061758710} + - {fileID: 444301740144869469} m_Father: {fileID: 7226858076299792826} m_RootOrder: 4 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -2290,7 +2292,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!224 &5616491715955234103 RectTransform: m_ObjectHideFlags: 0 @@ -2304,7 +2306,7 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 8591417510463701647} - m_RootOrder: 2 + 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} @@ -3782,8 +3784,16 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 79b7d4d08379c4a4b9c0c4a91499fb6d, type: 3} m_Name: m_EditorClassIdentifier: - player: {fileID: 0} pointsTxt: {fileID: 8367707976770782541} + mainHealthBar: {fileID: 6102993991279125145} + verticalHealthBars: + - {fileID: 2640022750990207684} + - {fileID: 3325980412281505347} + - {fileID: 4995318508139562728} + hpBarColorPerDimension: + - {r: 0.091847636, g: 0.14423606, b: 0.4528302, a: 1} + - {r: 0.21518761, g: 0.8207547, b: 0.127759, a: 1} + - {r: 0.8113208, g: 0.37032807, b: 0.11863652, a: 1} --- !u!1 &7226858076878993065 GameObject: m_ObjectHideFlags: 0 @@ -3936,82 +3946,6 @@ MonoBehaviour: m_FillOrigin: 0 m_UseSpriteMesh: 0 m_PixelsPerUnitMultiplier: 1 ---- !u!1 &7326714999335118993 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 2010045890940401534} - - component: {fileID: 565897196578875658} - - component: {fileID: 3954022060441994303} - m_Layer: 5 - m_Name: health_fill - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &2010045890940401534 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7326714999335118993} - 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: 8591417510463701647} - 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: 13.886993, y: -65.08267} - m_SizeDelta: {x: 500.5736, y: 54.4168} - m_Pivot: {x: 0.5, y: 0.5} ---- !u!222 &565897196578875658 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7326714999335118993} - m_CullTransparentMesh: 1 ---- !u!114 &3954022060441994303 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7326714999335118993} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Material: {fileID: 0} - m_Color: {r: 0.10065861, g: 0.735849, b: 0.13188064, 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: 21300000, guid: 17afab4130c76414badea0eea1f6638d, type: 3} - m_Type: 3 - m_PreserveAspect: 0 - m_FillCenter: 1 - m_FillMethod: 0 - m_FillAmount: 0.367 - m_FillClockwise: 1 - m_FillOrigin: 0 - m_UseSpriteMesh: 0 - m_PixelsPerUnitMultiplier: 1 --- !u!1 &7343102371801161858 GameObject: m_ObjectHideFlags: 0 @@ -4336,82 +4270,6 @@ MonoBehaviour: m_FillOrigin: 0 m_UseSpriteMesh: 0 m_PixelsPerUnitMultiplier: 1 ---- !u!1 &7589559408490877497 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 3735044009610982792} - - component: {fileID: 2357111211679627613} - - component: {fileID: 819304402467047829} - m_Layer: 5 - m_Name: health_background - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &3735044009610982792 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7589559408490877497} - 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: 8591417510463701647} - 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: 13.886993, y: -65.08267} - m_SizeDelta: {x: 500.5736, y: 54.4168} - m_Pivot: {x: 0.5, y: 0.5} ---- !u!222 &2357111211679627613 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7589559408490877497} - m_CullTransparentMesh: 1 ---- !u!114 &819304402467047829 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7589559408490877497} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Material: {fileID: 0} - m_Color: {r: 0, g: 0, b: 0, 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: 21300000, guid: 17afab4130c76414badea0eea1f6638d, type: 3} - m_Type: 0 - m_PreserveAspect: 0 - m_FillCenter: 1 - m_FillMethod: 4 - m_FillAmount: 1 - m_FillClockwise: 1 - m_FillOrigin: 0 - m_UseSpriteMesh: 0 - m_PixelsPerUnitMultiplier: 1 --- !u!1 &7968668739527502978 GameObject: m_ObjectHideFlags: 0 @@ -4429,7 +4287,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!224 &7174851450076484861 RectTransform: m_ObjectHideFlags: 0 @@ -4443,7 +4301,7 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 8591417510463701647} - m_RootOrder: 3 + 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} @@ -5416,3 +5274,479 @@ MonoBehaviour: m_hasFontAssetChanged: 0 m_baseMaterial: {fileID: 0} m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!1001 &3640897101369500366 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 8591417510463701647} + m_Modifications: + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_Pivot.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_Pivot.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_RootOrder + value: 3 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_AnchorMax.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_AnchorMax.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_AnchorMin.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_AnchorMin.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_SizeDelta.x + value: 100 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_SizeDelta.y + value: 100 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_LocalRotation.w + value: 0.7071068 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_LocalRotation.z + value: 0.7071068 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_AnchoredPosition.x + value: -1501 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_AnchoredPosition.y + value: 435 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 90 + objectReference: {fileID: 0} + - target: {fileID: 6317334477149384872, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_Name + value: VerticalHealthBar + objectReference: {fileID: 0} + - target: {fileID: 8379400679552536236, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_Color.b + value: 0.7075472 + objectReference: {fileID: 0} + - target: {fileID: 8379400679552536236, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_Color.g + value: 0.19524896 + objectReference: {fileID: 0} + - target: {fileID: 8379400679552536236, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_Color.r + value: 0.09678713 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 61be5703914295543b05f3342f01bb3c, type: 3} +--- !u!114 &2640022750990207684 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 1595450933592483850, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + m_PrefabInstance: {fileID: 3640897101369500366} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fc7ea5b1fff48b444b980ce43abc135c, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!224 &7483763325311061105 stripped +RectTransform: + m_CorrespondingSourceObject: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + m_PrefabInstance: {fileID: 3640897101369500366} + m_PrefabAsset: {fileID: 0} +--- !u!1001 &4038725818596863561 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 8591417510463701647} + m_Modifications: + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_Pivot.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_Pivot.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_RootOrder + value: 4 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_AnchorMax.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_AnchorMax.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_AnchorMin.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_AnchorMin.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_SizeDelta.x + value: 100 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_SizeDelta.y + value: 100 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_LocalRotation.w + value: 0.7071068 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_LocalRotation.z + value: 0.7071068 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_AnchoredPosition.x + value: -1403 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_AnchoredPosition.y + value: 435 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 90 + objectReference: {fileID: 0} + - target: {fileID: 6317334477149384872, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_Name + value: VerticalHealthBar (1) + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 61be5703914295543b05f3342f01bb3c, type: 3} +--- !u!114 &3325980412281505347 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 1595450933592483850, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + m_PrefabInstance: {fileID: 4038725818596863561} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fc7ea5b1fff48b444b980ce43abc135c, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!224 &7877029066061758710 stripped +RectTransform: + m_CorrespondingSourceObject: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + m_PrefabInstance: {fileID: 4038725818596863561} + m_PrefabAsset: {fileID: 0} +--- !u!1001 &4798056095452056211 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 8591417510463701647} + m_Modifications: + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_Pivot.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_Pivot.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_RootOrder + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_AnchorMax.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_AnchorMax.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_AnchorMin.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_AnchorMin.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_SizeDelta.x + value: 100 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_SizeDelta.y + value: 100 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6317334477149384872, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_Name + value: MainHealthBar + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 61be5703914295543b05f3342f01bb3c, type: 3} +--- !u!224 &1714364098846827564 stripped +RectTransform: + m_CorrespondingSourceObject: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + m_PrefabInstance: {fileID: 4798056095452056211} + m_PrefabAsset: {fileID: 0} +--- !u!114 &6102993991279125145 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 1595450933592483850, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + m_PrefabInstance: {fileID: 4798056095452056211} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fc7ea5b1fff48b444b980ce43abc135c, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1001 &6014207229380505314 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 8591417510463701647} + m_Modifications: + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_Pivot.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_Pivot.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_RootOrder + value: 5 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_AnchorMax.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_AnchorMax.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_AnchorMin.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_AnchorMin.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_SizeDelta.x + value: 100 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_SizeDelta.y + value: 100 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_LocalRotation.w + value: 0.7071068 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_LocalRotation.z + value: 0.7071068 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_AnchoredPosition.x + value: -1303 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_AnchoredPosition.y + value: 435 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 90 + objectReference: {fileID: 0} + - target: {fileID: 6317334477149384872, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_Name + value: VerticalHealthBar (2) + objectReference: {fileID: 0} + - target: {fileID: 8379400679552536236, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_Color.b + value: 0.10196077 + objectReference: {fileID: 0} + - target: {fileID: 8379400679552536236, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_Color.g + value: 0.24709329 + objectReference: {fileID: 0} + - target: {fileID: 8379400679552536236, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + propertyPath: m_Color.r + value: 0.7372549 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 61be5703914295543b05f3342f01bb3c, type: 3} +--- !u!224 &444301740144869469 stripped +RectTransform: + m_CorrespondingSourceObject: {fileID: 6150997385660329663, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + m_PrefabInstance: {fileID: 6014207229380505314} + m_PrefabAsset: {fileID: 0} +--- !u!114 &4995318508139562728 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 1595450933592483850, guid: 61be5703914295543b05f3342f01bb3c, type: 3} + m_PrefabInstance: {fileID: 6014207229380505314} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fc7ea5b1fff48b444b980ce43abc135c, type: 3} + m_Name: + m_EditorClassIdentifier: diff --git a/Assets/Prefabs/Dimension1/Dimension1.prefab b/Assets/Prefabs/Dimension1/Dimension1.prefab index dd75b89..2c24037 100644 --- a/Assets/Prefabs/Dimension1/Dimension1.prefab +++ b/Assets/Prefabs/Dimension1/Dimension1.prefab @@ -207,7 +207,7 @@ Transform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 2398580280527440449} - m_RootOrder: 0 + m_RootOrder: 1 m_LocalEulerAnglesHint: {x: -1.32, y: 0, z: 0} --- !u!33 &2398580280414369016 MeshFilter: @@ -461,7 +461,7 @@ Transform: - {fileID: 2398580281473075025} - {fileID: 2398580282036884597} m_Father: {fileID: 2398580280527440449} - m_RootOrder: 2 + m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &2398580280527440454 GameObject: @@ -491,6 +491,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: + - {fileID: 3122920859500152402} - {fileID: 2398580280414369023} - {fileID: 2398580281173991539} - {fileID: 2398580280514116546} @@ -1072,7 +1073,7 @@ Transform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 2398580280527440449} - m_RootOrder: 5 + m_RootOrder: 6 m_LocalEulerAnglesHint: {x: -1.32, y: 0, z: 0} --- !u!33 &2398580281113924508 MeshFilter: @@ -1155,7 +1156,7 @@ Transform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 2398580280527440449} - m_RootOrder: 1 + m_RootOrder: 2 m_LocalEulerAnglesHint: {x: -28.332, y: 0, z: 0} --- !u!33 &2398580281173991549 MeshFilter: @@ -1326,7 +1327,7 @@ Transform: - {fileID: 2398580280414332520} - {fileID: 2398580280739990207} m_Father: {fileID: 2398580280527440449} - m_RootOrder: 3 + m_RootOrder: 4 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &2398580281378808008 GameObject: @@ -1359,7 +1360,7 @@ Transform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 2398580280527440449} - m_RootOrder: 6 + m_RootOrder: 7 m_LocalEulerAnglesHint: {x: -1.32, y: 0, z: 0} --- !u!33 &2398580281378808021 MeshFilter: @@ -1940,7 +1941,7 @@ Transform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 2398580280527440449} - m_RootOrder: 4 + m_RootOrder: 5 m_LocalEulerAnglesHint: {x: -1.32, y: 0, z: 0} --- !u!33 &2398580281909144681 MeshFilter: @@ -2281,7 +2282,7 @@ Transform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 2398580280527440449} - m_RootOrder: 9 + m_RootOrder: 10 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &4588112000306363475 MonoBehaviour: @@ -2375,7 +2376,7 @@ Transform: - {fileID: 8360311633524412580} - {fileID: 1198892008880930734} m_Father: {fileID: 2398580280527440449} - m_RootOrder: 8 + m_RootOrder: 9 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &6859503625381157636 GameObject: @@ -2408,6 +2409,118 @@ Transform: m_Father: {fileID: 6576895058904098596} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &6973536880156014350 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3122920859500152402} + - component: {fileID: 2012323110346539457} + - component: {fileID: 1798967697912080973} + - component: {fileID: 8522344775109786027} + - component: {fileID: 5528713942592985617} + m_Layer: 0 + m_Name: DIMENSION_CONTROLLER + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &3122920859500152402 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6973536880156014350} + m_LocalRotation: {x: -0.01151752, y: -0, z: -0, w: 0.9999337} + m_LocalPosition: {x: 6.404957, y: -9.653287, z: 4.0262146} + m_LocalScale: {x: 72.31022, y: 11.12011, z: 85.71496} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 2398580280527440449} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: -1.32, y: 0, z: 0} +--- !u!33 &2012323110346539457 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6973536880156014350} + m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &1798967697912080973 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6973536880156014350} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 5871250831bcf02499be76202d393f00, type: 2} + 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: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!64 &8522344775109786027 +MeshCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6973536880156014350} + m_Material: {fileID: 0} + m_IsTrigger: 1 + m_Enabled: 1 + serializedVersion: 4 + m_Convex: 1 + m_CookingOptions: 30 + m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} +--- !u!114 &5528713942592985617 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6973536880156014350} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5dfc667192d2c2641bbd86b84f6dea74, type: 3} + m_Name: + m_EditorClassIdentifier: + dimensionId: 0 --- !u!1 &7745120426633950777 GameObject: m_ObjectHideFlags: 0 @@ -2472,7 +2585,7 @@ Transform: - {fileID: 633778514577777118} - {fileID: 7337768835324858517} m_Father: {fileID: 2398580280527440449} - m_RootOrder: 7 + m_RootOrder: 8 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1001 &1396733389042102710 PrefabInstance: @@ -2731,4 +2844,4 @@ PrefabInstance: Transform: m_CorrespondingSourceObject: {fileID: 8669146300404556697, guid: 9a43ba91eb395dd4fadd425be923e739, type: 3} m_PrefabInstance: {fileID: 6415244284158291209} - m_PrefabAsset: {fileID: 0} \ No newline at end of file + m_PrefabAsset: {fileID: 0} diff --git a/Assets/Prefabs/UI.meta b/Assets/Prefabs/UI.meta new file mode 100644 index 0000000..89b233b --- /dev/null +++ b/Assets/Prefabs/UI.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 79703c6a9bce0814aafd39c2114d9baf +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/UI/HealthBar.prefab b/Assets/Prefabs/UI/HealthBar.prefab new file mode 100644 index 0000000..3179ccb --- /dev/null +++ b/Assets/Prefabs/UI/HealthBar.prefab @@ -0,0 +1,300 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &218509848976950907 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3292477238973227557} + - component: {fileID: 5223125477649062208} + - component: {fileID: 3568815548724617746} + m_Layer: 5 + m_Name: health_fillWhite + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &3292477238973227557 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 218509848976950907} + 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: 6150997385660329663} + 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: 13.886993, y: -65.08267} + m_SizeDelta: {x: 500.5736, y: 54.4168} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &5223125477649062208 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 218509848976950907} + m_CullTransparentMesh: 1 +--- !u!114 &3568815548724617746 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 218509848976950907} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, 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_Sprite: {fileID: 21300000, guid: 17afab4130c76414badea0eea1f6638d, type: 3} + m_Type: 3 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 0 + m_FillAmount: 0.703 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &2827036679963156994 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6445496103502429677} + - component: {fileID: 4993478342136587161} + - component: {fileID: 8379400679552536236} + m_Layer: 5 + m_Name: health_fill + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &6445496103502429677 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2827036679963156994} + 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: 6150997385660329663} + 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: 13.886993, y: -65.08267} + m_SizeDelta: {x: 500.5736, y: 54.4168} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &4993478342136587161 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2827036679963156994} + m_CullTransparentMesh: 1 +--- !u!114 &8379400679552536236 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2827036679963156994} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.10065861, g: 0.735849, b: 0.13188064, 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: 21300000, guid: 17afab4130c76414badea0eea1f6638d, type: 3} + m_Type: 3 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 0 + m_FillAmount: 0.367 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &3154092637200570538 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8161529832744779547} + - component: {fileID: 7070715944331408334} + - component: {fileID: 5316745219644261126} + m_Layer: 5 + m_Name: health_background + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &8161529832744779547 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3154092637200570538} + 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: 6150997385660329663} + 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: 13.886993, y: -65.08267} + m_SizeDelta: {x: 500.5736, y: 54.4168} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &7070715944331408334 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3154092637200570538} + m_CullTransparentMesh: 1 +--- !u!114 &5316745219644261126 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3154092637200570538} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0, g: 0, b: 0, 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: 21300000, guid: 17afab4130c76414badea0eea1f6638d, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &6317334477149384872 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6150997385660329663} + - component: {fileID: 1595450933592483850} + - component: {fileID: 6110702178490715531} + m_Layer: 5 + m_Name: HealthBar + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &6150997385660329663 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6317334477149384872} + 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: + - {fileID: 8161529832744779547} + - {fileID: 3292477238973227557} + - {fileID: 6445496103502429677} + m_Father: {fileID: 0} + 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: 0} + m_SizeDelta: {x: 100, y: 100} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1595450933592483850 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6317334477149384872} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fc7ea5b1fff48b444b980ce43abc135c, type: 3} + m_Name: + m_EditorClassIdentifier: + canvasGroup: {fileID: 6110702178490715531} + visible: 1 + img_fill: {fileID: 8379400679552536236} + img_fillWhite: {fileID: 3568815548724617746} + imgWhiteFillSpeed: 1 +--- !u!225 &6110702178490715531 +CanvasGroup: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6317334477149384872} + m_Enabled: 1 + m_Alpha: 1 + m_Interactable: 1 + m_BlocksRaycasts: 1 + m_IgnoreParentGroups: 0 diff --git a/Assets/Prefabs/UI/HealthBar.prefab.meta b/Assets/Prefabs/UI/HealthBar.prefab.meta new file mode 100644 index 0000000..d22f23c --- /dev/null +++ b/Assets/Prefabs/UI/HealthBar.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 61be5703914295543b05f3342f01bb3c +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/DimensionController.cs b/Assets/Scripts/DimensionController.cs index 64dd683..88188b6 100644 --- a/Assets/Scripts/DimensionController.cs +++ b/Assets/Scripts/DimensionController.cs @@ -2,7 +2,7 @@ using UnityEngine; public class DimensionController : MonoBehaviour { - static private int STARTING_HP = 25; + public const int STARTING_HP = 25; [SerializeField] private int dimensionId; diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs index 5668dcf..ba1e498 100644 --- a/Assets/Scripts/GameManager.cs +++ b/Assets/Scripts/GameManager.cs @@ -1,22 +1,20 @@ -using UnityEngine; +using UnityEngine; using UnityEngine.InputSystem; public class GameManager : MonoBehaviour { - private const int STARTING_DIMENSION_ID = 2; - [SerializeField] private PlayerInput controls; [SerializeField] private CannonScript[] cannonList; [SerializeField] private UIController uiController; - + [SerializeField] private WorldSwitcher worldSwitcher; + [Header("Game Variables")] [SerializeField, ReadOnly] private GameState state; [SerializeField, ReadOnly] private float points; - [SerializeField, ReadOnly] private int currentDimensionID = STARTING_DIMENSION_ID; + [field: SerializeField, ReadOnly] public int CurrentDimensionID { get; private set; } public static GameManager Instance { get; private set; } - private void Awake() { if (Instance != null && Instance != this) @@ -26,16 +24,28 @@ public class GameManager : MonoBehaviour else { Instance = this; - currentDimensionID = STARTING_DIMENSION_ID; state = GameState.InGame; points = 0f; + + CurrentDimensionID = worldSwitcher.CurrentWorldIndex; + worldSwitcher.OnChangeWorld.AddListener((int newDimensionID)=> + { + CurrentDimensionID = newDimensionID; + uiController.SetCurrentDimension(CurrentDimensionID, DimensionController.STARTING_HP, DimensionController.STARTING_HP); + Debug.Log("Changed dimension to: " + newDimensionID + "!"); + }); + + // Vive le spaghetti 🍝🍝🍝 + uiController.SetCurrentDimension(CurrentDimensionID, + DimensionController.STARTING_HP, + DimensionController.STARTING_HP); uiController.UpdatePointsText(points); } } public void DealDamage(int dimensionID, float hp, float maxHP) { - uiController.SetDimensionHP(currentDimensionID, dimensionID, hp, maxHP); + uiController.SetDimensionHP(CurrentDimensionID, dimensionID, hp, maxHP); // Check loss condition if (hp <= 0) diff --git a/Assets/Scripts/UI/HealthBar/ConjureUIElement.cs b/Assets/Scripts/UI/HealthBar/ConjureUIElement.cs new file mode 100644 index 0000000..1a2d2ae --- /dev/null +++ b/Assets/Scripts/UI/HealthBar/ConjureUIElement.cs @@ -0,0 +1,27 @@ +using System.Collections; +using UnityEngine; + +public class ConjureUIElement : MonoBehaviour +{ + public CanvasGroup canvasGroup; + public bool visible; + + protected virtual void Awake() + { + canvasGroup = GetComponent(); + if (canvasGroup == null) { canvasGroup = this.gameObject.AddComponent(); } + + if (canvasGroup.alpha > 0f) { visible = true; } + } + + public virtual void SetVisible(bool yes) + { + if (visible == yes) { return; } + + visible = yes; + canvasGroup.interactable = yes; + canvasGroup.blocksRaycasts = yes; + + canvasGroup.alpha = (yes) ? 1f : 0f; + } +} \ No newline at end of file diff --git a/Assets/Scripts/UI/HealthBar/ConjureUIElement.cs.meta b/Assets/Scripts/UI/HealthBar/ConjureUIElement.cs.meta new file mode 100644 index 0000000..520b015 --- /dev/null +++ b/Assets/Scripts/UI/HealthBar/ConjureUIElement.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 384c19fc55f425c489a66a05ce6fa06a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/UI/HealthBar/HealthBar.cs b/Assets/Scripts/UI/HealthBar/HealthBar.cs index 173c7fe..8ba6500 100644 --- a/Assets/Scripts/UI/HealthBar/HealthBar.cs +++ b/Assets/Scripts/UI/HealthBar/HealthBar.cs @@ -2,7 +2,7 @@ using UnityEngine; using UnityEngine.UI; -public class HealthBar : MonoBehaviour +public class HealthBar : ConjureUIElement { [SerializeField] private Image img_fill; [SerializeField] private Image img_fillWhite; @@ -10,6 +10,14 @@ public class HealthBar : MonoBehaviour private float targetFillAmount; + protected override void Awake() + { + base.Awake(); + + img_fill.fillAmount = 1f; + img_fillWhite.fillAmount = 1f; + } + private void Update() { img_fillWhite.fillAmount = Mathf.Lerp(img_fillWhite.fillAmount, targetFillAmount, Time.deltaTime * imgWhiteFillSpeed); @@ -20,4 +28,9 @@ public class HealthBar : MonoBehaviour targetFillAmount = fillingAmount; img_fill.fillAmount = targetFillAmount; } + + public void SetFillingColor(Color newColor) + { + img_fill.color = newColor; + } } \ No newline at end of file diff --git a/Assets/Scripts/UIController.cs b/Assets/Scripts/UIController.cs index 0d31872..9d5eeb2 100644 --- a/Assets/Scripts/UIController.cs +++ b/Assets/Scripts/UIController.cs @@ -8,23 +8,37 @@ public class UIController : MonoBehaviour { [SerializeField] private TMP_Text pointsTxt; - [SerializeField] private HealthBar mainHealtBars; + [SerializeField] private HealthBar mainHealthBar; [SerializeField] private HealthBar[] verticalHealthBars; + [SerializeField] private Color[] hpBarColorPerDimension; + public void UpdatePointsText(float points) { pointsTxt.text = points.ToString("0"); } + public void SetCurrentDimension(int currentDimensionID, float currentDimensionHP, float currentDimensionMaxHP) + { + foreach (HealthBar verticalHealthBar in verticalHealthBars) + { + verticalHealthBar.SetVisible(true); + } + verticalHealthBars[currentDimensionID].SetVisible(false); + + mainHealthBar.SetFillingColor(hpBarColorPerDimension[currentDimensionID]); + mainHealthBar.SetFillingAmount(currentDimensionHP / currentDimensionMaxHP); + } + public void SetDimensionHP(int currentDimensionID, int dimensionID, float hp, float maxHP) { float hpFillingAmount = hp / maxHP; - verticalHealthBars[dimensionID - 1].SetFillingAmount(hpFillingAmount); + verticalHealthBars[dimensionID].SetFillingAmount(hpFillingAmount); // Also change main HP bar if this is the current dimension. if (currentDimensionID == dimensionID) { - mainHealtBars.SetFillingAmount(hpFillingAmount); + mainHealthBar.SetFillingAmount(hpFillingAmount); } } } diff --git a/Assets/Scripts/WorldSwitcher.cs b/Assets/Scripts/WorldSwitcher.cs index 59802f0..3909ded 100644 --- a/Assets/Scripts/WorldSwitcher.cs +++ b/Assets/Scripts/WorldSwitcher.cs @@ -1,6 +1,10 @@ using System; using System.Collections; using UnityEngine; +using UnityEngine.Events; + +[Serializable] +public class IntEvent : UnityEvent { } public class WorldSwitcher : MonoBehaviour { [Range(0, 5)] @@ -21,6 +25,10 @@ public class WorldSwitcher : MonoBehaviour { Coroutine transition; static readonly int UVOffset = Shader.PropertyToID("_UVOffset"); + public IntEvent OnChangeWorld; + + public int CurrentWorldIndex { get { return currentWorldIndex; } } + void Awake() { if (worldInfos.Length != 3) Debug.LogWarning("For now, WorldSwitcher should have 3 worlds."); @@ -56,6 +64,8 @@ public class WorldSwitcher : MonoBehaviour { else currentWorldIndex--; + OnChangeWorld.Invoke(currentWorldIndex); + transition = StartCoroutine(TransitionCamera(right)); }