diff --git a/Assets/Data/Waves/Basic Wave.asset b/Assets/Data/Waves/Basic Wave.asset index c3ce7c3..4473de7 100644 --- a/Assets/Data/Waves/Basic Wave.asset +++ b/Assets/Data/Waves/Basic Wave.asset @@ -14,5 +14,5 @@ MonoBehaviour: m_EditorClassIdentifier: spawns: - enemyPrefab: {fileID: 204632724861940951, guid: d5225fe09f2ee0168b3a40e21948820a, type: 3} - count: 12 + count: 500 spawnInterval: 0.5 diff --git a/Assets/Scenes/main.unity b/Assets/Scenes/main.unity index c6468e6..3142354 100644 --- a/Assets/Scenes/main.unity +++ b/Assets/Scenes/main.unity @@ -7378,6 +7378,7 @@ GameObject: - component: {fileID: 1368041000} - component: {fileID: 1368040999} - component: {fileID: 1368040998} + - component: {fileID: 1368041002} m_Layer: 5 m_Name: HUD m_TagString: Untagged @@ -7461,6 +7462,7 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: - {fileID: 640255471} + - {fileID: 1964800944} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} @@ -7468,6 +7470,22 @@ RectTransform: m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0, y: 0} +--- !u!114 &1368041002 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1368040997} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f17a4078172c4757abde33b7929f180e, type: 3} + m_Name: + m_EditorClassIdentifier: + expText: {fileID: 756228653} + coinsText: {fileID: 1375690238} + roundTimeLeftText: {fileID: 1964800945} + healthSlider: {fileID: 2032896404} --- !u!1 &1375690236 GameObject: m_ObjectHideFlags: 0 @@ -7480,7 +7498,7 @@ GameObject: - component: {fileID: 1375690239} - component: {fileID: 1375690238} m_Layer: 5 - m_Name: Exp (1) + m_Name: Coins m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -7723,6 +7741,142 @@ Transform: m_Children: [] m_Father: {fileID: 54233099} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1964800943 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1964800944} + - component: {fileID: 1964800946} + - component: {fileID: 1964800945} + m_Layer: 5 + m_Name: Round time left + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1964800944 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1964800943} + 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: 1368041001} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 1, y: 1} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: -54.115, y: -25} + m_SizeDelta: {x: 108.23, y: 50} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1964800945 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1964800943} + 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: 60s + 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: 4 + 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 &1964800946 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1964800943} + m_CullTransparentMesh: 1 --- !u!1 &1975785669 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/Systems/GameManager.cs b/Assets/Scripts/Systems/GameManager.cs index 0524510..988303c 100644 --- a/Assets/Scripts/Systems/GameManager.cs +++ b/Assets/Scripts/Systems/GameManager.cs @@ -25,6 +25,7 @@ namespace Systems public float RoundTime => roundTime; public int MaxRounds => maxRounds; public bool StoreIsClosed { get; set; } = true; + public float RoundTimeLeft => Mathf.Max(0, timer); public event Action OnRoundStart; public event Action OnRoundEnd; diff --git a/Assets/Scripts/UI.meta b/Assets/Scripts/UI.meta new file mode 100644 index 0000000..bde3153 --- /dev/null +++ b/Assets/Scripts/UI.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 72517a62486742de96c31c1f3a3a58d5 +timeCreated: 1752332352 \ No newline at end of file diff --git a/Assets/Scripts/UI/GameHud.cs b/Assets/Scripts/UI/GameHud.cs new file mode 100644 index 0000000..0f2e6ed --- /dev/null +++ b/Assets/Scripts/UI/GameHud.cs @@ -0,0 +1,28 @@ +using System; +using Systems; +using TMPro; +using UnityEngine; +using UnityEngine.UI; + +namespace UI +{ + public class GameHud : MonoBehaviour + { + [SerializeField] private TextMeshProUGUI expText; + [SerializeField] private TextMeshProUGUI coinsText; + [SerializeField] private TextMeshProUGUI roundTimeLeftText; + [SerializeField] private Slider healthSlider; + + private void Update() + { + var player = GameManager.Instance.Player; + if (!player) return; + + expText.text = $"EXP: {player.attributes.Experience}"; + coinsText.text = $"Coins: {GameManager.Instance.Coins}"; + roundTimeLeftText.text = $"{GameManager.Instance.RoundTimeLeft:F1}s"; + healthSlider.maxValue = player.attributes.MaxHealth; + healthSlider.value = player.attributes.Health; + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/UI/GameHud.cs.meta b/Assets/Scripts/UI/GameHud.cs.meta new file mode 100644 index 0000000..f083fbc --- /dev/null +++ b/Assets/Scripts/UI/GameHud.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: f17a4078172c4757abde33b7929f180e +timeCreated: 1752332367 \ No newline at end of file