diff --git a/Assets/Prefabs/BossEnemy.prefab b/Assets/Prefabs/BossEnemy.prefab index d59da10..95c7a1d 100644 --- a/Assets/Prefabs/BossEnemy.prefab +++ b/Assets/Prefabs/BossEnemy.prefab @@ -283,8 +283,8 @@ MonoBehaviour: sprite: {fileID: 2925441294215993266} stalled: 0 invincible: 0 - health: 100 - maxHealth: 100 + health: 1000 + maxHealth: 1000 isFacingRight: 0 rb: {fileID: 3678290925386274447} speed: 6 diff --git a/Assets/Prefabs/Marisa.prefab b/Assets/Prefabs/Marisa.prefab index 165f732..a3965e9 100644 --- a/Assets/Prefabs/Marisa.prefab +++ b/Assets/Prefabs/Marisa.prefab @@ -612,6 +612,10 @@ MonoBehaviour: secondaryAttackInstance: {fileID: 0} spellAInstance: {fileID: 0} spellBInstance: {fileID: 0} + mainIcon: {fileID: 0} + secondaryIcon: {fileID: 0} + spellAIcon: {fileID: 0} + spellBIcon: {fileID: 0} --- !u!114 &4421559795750709312 MonoBehaviour: m_ObjectHideFlags: 0 @@ -836,6 +840,8 @@ MonoBehaviour: mouseWorldPos: {x: 0, y: 0} firingPointBase: {fileID: 1955417614592701310} firingPoint: {fileID: 6266582235186827771} + hpBarUI: {fileID: 0} + healthText: {fileID: 0} --- !u!1 &6396436912902618782 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scenes/Game.unity b/Assets/Scenes/Game.unity index c050729..63fb9a4 100644 --- a/Assets/Scenes/Game.unity +++ b/Assets/Scenes/Game.unity @@ -119,6 +119,142 @@ NavMeshSettings: debug: m_Flags: 0 m_NavMeshData: {fileID: 0} +--- !u!1 &17999209 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 17999210} + - component: {fileID: 17999212} + - component: {fileID: 17999211} + m_Layer: 5 + m_Name: BossName + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &17999210 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 17999209} + 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: 1034624966} + 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: -500, y: -56} + m_SizeDelta: {x: 200, y: 50} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &17999211 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 17999209} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, 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_text: BIG SCARY BOSS + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4294967295 + m_fontColor: {r: 1, g: 1, b: 1, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 36 + m_fontSizeBase: 36 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 1 + m_VerticalAlignment: 256 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_TextWrappingMode: 0 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 0 + m_ActiveFontFeatures: 6e72656b + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_EmojiFallbackSupport: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!222 &17999212 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 17999209} + m_CullTransparentMesh: 1 --- !u!1 &161505811 GameObject: m_ObjectHideFlags: 0 @@ -286,6 +422,7 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: - {fileID: 1008626378} + - {fileID: 1264758720} m_Father: {fileID: 1935311237} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} @@ -605,10 +742,6 @@ PrefabInstance: propertyPath: m_Name value: Marisa objectReference: {fileID: 0} - - target: {fileID: 5080576259360811646, guid: 8764555a5fdde3428903d7ac06f8ff7f, type: 3} - propertyPath: m_IsActive - value: 1 - objectReference: {fileID: 0} - target: {fileID: 5275979051295637757, guid: 8764555a5fdde3428903d7ac06f8ff7f, type: 3} propertyPath: cam value: @@ -617,6 +750,10 @@ PrefabInstance: propertyPath: hpBarUI value: objectReference: {fileID: 1008626378} + - target: {fileID: 5275979051295637757, guid: 8764555a5fdde3428903d7ac06f8ff7f, type: 3} + propertyPath: healthText + value: + objectReference: {fileID: 1264758721} - target: {fileID: 5661264056639479186, guid: 8764555a5fdde3428903d7ac06f8ff7f, type: 3} propertyPath: m_LocalPosition.x value: 0 @@ -1599,6 +1736,142 @@ Transform: - {fileID: 2000423408} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &879588200 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 879588201} + - component: {fileID: 879588203} + - component: {fileID: 879588202} + m_Layer: 5 + m_Name: HealthText + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &879588201 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 879588200} + 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: 1034624966} + 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: -20, y: -20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &879588202 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 879588200} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, 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_text: 100/100 + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4294967295 + m_fontColor: {r: 1, g: 1, b: 1, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 35.8 + m_fontSizeBase: 36 + m_fontWeight: 400 + m_enableAutoSizing: 1 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 2 + m_VerticalAlignment: 512 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_TextWrappingMode: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 0 + m_ActiveFontFeatures: 6e72656b + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_EmojiFallbackSupport: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!222 &879588203 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 879588200} + m_CullTransparentMesh: 1 --- !u!1 &905335569 GameObject: m_ObjectHideFlags: 0 @@ -2172,6 +2445,8 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: - {fileID: 1923631094} + - {fileID: 879588201} + - {fileID: 17999210} m_Father: {fileID: 351951402} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 1} @@ -2381,6 +2656,142 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1205925643} m_CullTransparentMesh: 1 +--- !u!1 &1264758719 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1264758720} + - component: {fileID: 1264758722} + - component: {fileID: 1264758721} + m_Layer: 5 + m_Name: PlayerHealthText + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1264758720 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1264758719} + 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: 229603539} + 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: -10} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1264758721 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1264758719} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, 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_text: 100/100 + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4294967295 + m_fontColor: {r: 1, g: 1, b: 1, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 44.75 + m_fontSizeBase: 36 + m_fontWeight: 400 + m_enableAutoSizing: 1 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 2 + m_VerticalAlignment: 512 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_TextWrappingMode: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 0 + m_ActiveFontFeatures: 6e72656b + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_EmojiFallbackSupport: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!222 &1264758722 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1264758719} + m_CullTransparentMesh: 1 --- !u!1001 &1266315745 PrefabInstance: m_ObjectHideFlags: 0 @@ -3884,6 +4295,8 @@ MonoBehaviour: bossSpawnPoint: {fileID: 382827739} bossUI: {fileID: 351951401} bossHealthBar: {fileID: 1923631094} + bossHealthText: {fileID: 879588202} + bossNameText: {fileID: 17999211} enemyFolder: {fileID: 1319590957} player: {fileID: 1582287016} --- !u!4 &1972076835 diff --git a/Assets/Scripts/Entities/Enemy/EnemySpawner.cs b/Assets/Scripts/Entities/Enemy/EnemySpawner.cs index 069078b..6474421 100644 --- a/Assets/Scripts/Entities/Enemy/EnemySpawner.cs +++ b/Assets/Scripts/Entities/Enemy/EnemySpawner.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using TMPro; using UnityEngine; using Random = UnityEngine.Random; @@ -33,6 +34,8 @@ public class EnemySpawner : MonoBehaviour public Transform bossSpawnPoint; [SerializeField] private GameObject bossUI; [SerializeField] private Transform bossHealthBar; + [SerializeField] private TextMeshProUGUI bossHealthText; + [SerializeField] private TextMeshProUGUI bossNameText; [Header("Cache")] [SerializeField] private Transform enemyFolder; [SerializeField] private Marisa player; @@ -64,10 +67,12 @@ public class EnemySpawner : MonoBehaviour bossUI.SetActive(true); canSpawn = false; Enemy.OnDamaged += UpdateBossHealthBar; //this kinda sucks but it technically works?? + bossNameText.text = bossEnemyInstance.entityName; } private void UpdateBossHealthBar() { bossHealthBar.localScale = new Vector3(Math.Clamp(bossEnemyInstance.health / bossEnemyInstance.maxHealth, 0, bossEnemyInstance.maxHealth), 1, 1); + bossHealthText.text = $"{bossEnemyInstance.health}/{bossEnemyInstance.maxHealth}"; } } diff --git a/Assets/Scripts/Entities/Marisa.cs b/Assets/Scripts/Entities/Marisa.cs index 51aff62..18ba2c4 100644 --- a/Assets/Scripts/Entities/Marisa.cs +++ b/Assets/Scripts/Entities/Marisa.cs @@ -1,5 +1,6 @@ using System; using Core.Extensions; +using TMPro; using UnityEngine; public class Marisa : Entity @@ -11,6 +12,7 @@ public class Marisa : Entity public Transform firingPoint; [Header("UI")] [SerializeField] private Transform hpBarUI; + [SerializeField] private TextMeshProUGUI healthText; private void Update() { mouseWorldPos = cam.ScreenToWorldPoint(Input.mousePosition); @@ -32,5 +34,6 @@ public class Marisa : Entity private void UpdateHealthUI() { hpBarUI.localScale = new Vector3(Math.Clamp(health/maxHealth,0,maxHealth), 1,1); + healthText.text = $"{health}/{maxHealth}"; } }