From d4589318f22c1114deee5d9e53a57e9355f9f239 Mon Sep 17 00:00:00 2001 From: KOSMOGOR Date: Mon, 28 Apr 2025 14:20:49 +0300 Subject: [PATCH] add: player UI update: some enemies balance --- Assets/Prefabs/Enemies/EnemyBullet.prefab | 4 +- Assets/Prefabs/Enemies/Eye_Enemy1.prefab | 3 +- Assets/Prefabs/Game/Player.prefab | 519 +++++++++++++++++- Assets/Scripts/Game/LevelController.cs | 2 + Assets/Scripts/Player/Player.cs | 2 + Assets/Scripts/Player/PlayerInterface.cs | 27 + Assets/Scripts/Player/PlayerInterface.cs.meta | 2 + Assets/Scripts/Player/PlayerMovement.cs | 6 +- Assets/Scripts/Player/WeaponController.cs | 2 + 9 files changed, 550 insertions(+), 17 deletions(-) create mode 100644 Assets/Scripts/Player/PlayerInterface.cs create mode 100644 Assets/Scripts/Player/PlayerInterface.cs.meta diff --git a/Assets/Prefabs/Enemies/EnemyBullet.prefab b/Assets/Prefabs/Enemies/EnemyBullet.prefab index 34a2dd5..603fe45 100644 --- a/Assets/Prefabs/Enemies/EnemyBullet.prefab +++ b/Assets/Prefabs/Enemies/EnemyBullet.prefab @@ -149,6 +149,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 8d7536bbb5cbf394b8ec742b12cb0b87, type: 3} m_Name: m_EditorClassIdentifier: - speed: 5 - damage: 1 + speed: 10 + damage: 5 timeToLive: 5 diff --git a/Assets/Prefabs/Enemies/Eye_Enemy1.prefab b/Assets/Prefabs/Enemies/Eye_Enemy1.prefab index 699e474..c5337f3 100644 --- a/Assets/Prefabs/Enemies/Eye_Enemy1.prefab +++ b/Assets/Prefabs/Enemies/Eye_Enemy1.prefab @@ -150,10 +150,11 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: hp: 100 + prefab: {fileID: 0} projectilePrefab: {fileID: 1562924000103655330, guid: 6a9f72b16f60d5047974eb5893b0326a, type: 3} projectileSpawnPosition: {fileID: 8051388752729122526} attackRange: 10 - fireRate: 1 + fireRate: 0.8 offsetDistance: 1.5 currentDelay: 0 target: {fileID: 0} diff --git a/Assets/Prefabs/Game/Player.prefab b/Assets/Prefabs/Game/Player.prefab index 63158ea..6095a5e 100644 --- a/Assets/Prefabs/Game/Player.prefab +++ b/Assets/Prefabs/Game/Player.prefab @@ -69,7 +69,7 @@ MonoBehaviour: groundMask: serializedVersion: 2 m_Bits: 64 ---- !u!1 &1084592339258698369 +--- !u!1 &1593691850003196257 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -77,29 +77,134 @@ GameObject: m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - - component: {fileID: 2033391409425088012} - m_Layer: 0 - m_Name: LegsPosition + - component: {fileID: 6015531580126524807} + - component: {fileID: 4720682156438956312} + - component: {fileID: 8093746698590632445} + m_Layer: 5 + m_Name: TextBullets m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!4 &2033391409425088012 -Transform: +--- !u!224 &6015531580126524807 +RectTransform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1084592339258698369} - serializedVersion: 2 + m_GameObject: {fileID: 1593691850003196257} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: -0.9, z: 0} + m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] - m_Father: {fileID: 6890030909251295590} + m_Father: {fileID: 4731455585906338868} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 1, y: 0} + m_AnchorMax: {x: 1, y: 0} + m_AnchoredPosition: {x: -100, y: 50} + m_SizeDelta: {x: 100, y: 50} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &4720682156438956312 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1593691850003196257} + m_CullTransparentMesh: 1 +--- !u!114 &8093746698590632445 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1593691850003196257} + 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: 1000 + 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: 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!1 &1629483633304816955 GameObject: m_ObjectHideFlags: 0 @@ -240,6 +345,398 @@ MonoBehaviour: m_MipBias: 0 m_VarianceClampScale: 0.9 m_ContrastAdaptiveSharpening: 0 +--- !u!1 &1768690545079255035 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2087916509921354166} + - component: {fileID: 2554197534496854829} + - component: {fileID: 3160991285208483983} + m_Layer: 5 + m_Name: TextHP + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2087916509921354166 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1768690545079255035} + 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: 4731455585906338868} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 150, y: 50} + m_SizeDelta: {x: 200, y: 50} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2554197534496854829 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1768690545079255035} + m_CullTransparentMesh: 1 +--- !u!114 &3160991285208483983 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1768690545079255035} + 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: 36 + m_fontSizeBase: 36 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 1 + 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!1 &2198513854607422592 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4731455585906338868} + - component: {fileID: 8606392222127518778} + - component: {fileID: 1203034536845416999} + - component: {fileID: 8850864838079087721} + - component: {fileID: 6379920192384756838} + m_Layer: 5 + m_Name: Canvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &4731455585906338868 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2198513854607422592} + 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_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 7172091115961889418} + - {fileID: 2087916509921354166} + - {fileID: 6015531580126524807} + m_Father: {fileID: 6890030909251295590} + 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!223 &8606392222127518778 +Canvas: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2198513854607422592} + m_Enabled: 1 + 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_VertexColorAlwaysGammaSpace: 1 + m_AdditionalShaderChannelsFlag: 25 + m_UpdateRectTransformForStandalone: 0 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 +--- !u!114 &1203034536845416999 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2198513854607422592} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, 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 + m_PresetInfoIsWorld: 0 +--- !u!114 &8850864838079087721 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2198513854607422592} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreReversedGraphics: 1 + m_BlockingObjects: 0 + m_BlockingMask: + serializedVersion: 2 + m_Bits: 4294967295 +--- !u!114 &6379920192384756838 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2198513854607422592} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1034c9030ffcd9b48b11a0c83921cc28, type: 3} + m_Name: + m_EditorClassIdentifier: + textTime: {fileID: 3783941606567679535} + textHP: {fileID: 3160991285208483983} + textBullets: {fileID: 8093746698590632445} +--- !u!1 &2651986001709754923 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7172091115961889418} + - component: {fileID: 1610488001899351068} + - component: {fileID: 3783941606567679535} + m_Layer: 5 + m_Name: TextTime + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &7172091115961889418 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2651986001709754923} + 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: 4731455585906338868} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 1} + m_AnchorMax: {x: 0.5, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 150, y: 50} + m_Pivot: {x: 0.5, y: 1} +--- !u!222 &1610488001899351068 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2651986001709754923} + m_CullTransparentMesh: 1 +--- !u!114 &3783941606567679535 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2651986001709754923} + 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: 00:00 + 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: 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!1 &9016311960615966999 GameObject: m_ObjectHideFlags: 0 @@ -278,8 +775,8 @@ Transform: m_ConstrainProportionsScale: 0 m_Children: - {fileID: 4506534449155536579} - - {fileID: 2033391409425088012} - {fileID: 7488478172684744634} + - {fileID: 4731455585906338868} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!33 &1892283461227420150 diff --git a/Assets/Scripts/Game/LevelController.cs b/Assets/Scripts/Game/LevelController.cs index 6e75ec6..9cebeb4 100644 --- a/Assets/Scripts/Game/LevelController.cs +++ b/Assets/Scripts/Game/LevelController.cs @@ -41,6 +41,8 @@ public class LevelController : MonoBehaviour GameController.i.OnLevelFailed(SceneManager.GetActiveScene().name, timeSpent, aliveEnemies); GameController.i.LoadDeployScene(); } + + public float GetTimeSpent() { return timeSpent; } } [Serializable] diff --git a/Assets/Scripts/Player/Player.cs b/Assets/Scripts/Player/Player.cs index 32d0c33..7ad1ecf 100644 --- a/Assets/Scripts/Player/Player.cs +++ b/Assets/Scripts/Player/Player.cs @@ -16,4 +16,6 @@ public class Player : MonoBehaviour FindAnyObjectByType().OnPlayerDie(); } } + + public float GetHp() { return hp; } } diff --git a/Assets/Scripts/Player/PlayerInterface.cs b/Assets/Scripts/Player/PlayerInterface.cs new file mode 100644 index 0000000..78e1dd7 --- /dev/null +++ b/Assets/Scripts/Player/PlayerInterface.cs @@ -0,0 +1,27 @@ +using System; +using TMPro; +using UnityEngine; + +public class PlayerInterface : MonoBehaviour +{ + public TMP_Text textTime; + public TMP_Text textHP; + public TMP_Text textBullets; + + Player player; + WeaponController weaponController; + LevelController levelController; + + void Start() { + player = GetComponentInParent(); + weaponController = GetComponentInParent(); + levelController = FindFirstObjectByType(); + } + + void Update() { + if (levelController) textTime.text = TimeSpan.FromSeconds(levelController.GetTimeSpent()).ToString(@"mm\:ss"); + textHP.text = $"{(int)player.GetHp()}/{player.maxHp}"; + Weapon currentWeapon = weaponController.GetCurrentWeapon(); + textBullets.text = currentWeapon && currentWeapon.bulletType != BulletType.None ? GameController.i.GetBulletCount(currentWeapon.bulletType).ToString() : "-"; + } +} diff --git a/Assets/Scripts/Player/PlayerInterface.cs.meta b/Assets/Scripts/Player/PlayerInterface.cs.meta new file mode 100644 index 0000000..12c8c6e --- /dev/null +++ b/Assets/Scripts/Player/PlayerInterface.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 1034c9030ffcd9b48b11a0c83921cc28 \ No newline at end of file diff --git a/Assets/Scripts/Player/PlayerMovement.cs b/Assets/Scripts/Player/PlayerMovement.cs index 5348631..b4f6f5e 100644 --- a/Assets/Scripts/Player/PlayerMovement.cs +++ b/Assets/Scripts/Player/PlayerMovement.cs @@ -47,7 +47,7 @@ public class PlayerMovement : MonoBehaviour void HandleJumping() { if (Input.GetKey(KeyCode.Space) && grounded) { - gravityVelocity = Vector3.up * (jumpForce * gravityMultiplier); + gravityVelocity = Vector3.up * jumpForce; } } @@ -64,8 +64,8 @@ public class PlayerMovement : MonoBehaviour void DoGravity() { if (grounded && gravityVelocity.y < 0) gravityVelocity = Vector3.zero; - gravityVelocity += Physics.gravity * Time.deltaTime; - characterController.Move(gravityVelocity * (Time.deltaTime * gravityMultiplier)); + gravityVelocity += Physics.gravity * (Time.deltaTime * gravityMultiplier); + characterController.Move(gravityVelocity * Time.deltaTime); } void OnControllerColliderHit(ControllerColliderHit hit) { diff --git a/Assets/Scripts/Player/WeaponController.cs b/Assets/Scripts/Player/WeaponController.cs index 1ae598b..f21a0ca 100644 --- a/Assets/Scripts/Player/WeaponController.cs +++ b/Assets/Scripts/Player/WeaponController.cs @@ -32,4 +32,6 @@ public class WeaponController : MonoBehaviour weapons[ind].SetWeaponState(true); currentWeapon = ind; } + + public Weapon GetCurrentWeapon() { return weapons.Length > 0 ? weapons[currentWeapon] : null; } }