From 4ff8d49f58f7b571cbc247bacbf650be003ca32e Mon Sep 17 00:00:00 2001 From: sega Date: Fri, 15 May 2026 15:35:19 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A0=D0=B0=D0=BA=D0=B5=D1=82=D1=8B=20=D0=BC?= =?UTF-8?q?=D0=BE=D0=B6=D0=BD=D0=BE=20=D1=81=D1=82=D1=80=D0=B5=D0=BB=D1=8F?= =?UTF-8?q?=D1=82=D1=8C=20=D0=BF=D0=BE=20=D0=BF=D0=B5=D1=80=D0=B5=D0=B7?= =?UTF-8?q?=D0=B0=D1=80=D1=8F=D0=B4=D0=BA=D0=B5.=20=D0=A0=D0=B0=D0=B7?= =?UTF-8?q?=D0=B4=D0=B5=D0=BB=D0=B5=D0=BD=D1=8B=20=D0=B4=D0=B0=D1=82=D1=87?= =?UTF-8?q?=D0=B8=D0=BA=D0=B8=20=D0=BF=D0=B5=D1=80=D0=B5=D0=B7=D0=B0=D1=80?= =?UTF-8?q?=D1=8F=D0=B4=D0=BA=D0=B8=20=D0=BD=D0=B0=20=D1=8D=D0=BA=D1=80?= =?UTF-8?q?=D0=B0=D0=BD=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Prefabs/Gameplay/Missile.prefab | 36 ++-- Assets/Scenes/Gameplay.unity | 200 +++++++++++++++++- .../Gameplay/Core/UI/AmmoScreenView.cs | 16 +- .../Gameplay/Core/Weapons/MissileWeapon.cs | 25 ++- .../Scripts/Gameplay/Core/Weapons/Weapon.cs | 2 +- 5 files changed, 235 insertions(+), 44 deletions(-) diff --git a/Assets/Prefabs/Gameplay/Missile.prefab b/Assets/Prefabs/Gameplay/Missile.prefab index 6f00612..e190fd5 100644 --- a/Assets/Prefabs/Gameplay/Missile.prefab +++ b/Assets/Prefabs/Gameplay/Missile.prefab @@ -131,7 +131,7 @@ ParticleSystem: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 6974338937679349821} serializedVersion: 8 - lengthInSec: 3 + lengthInSec: 60 simulationSpeed: 1 stopAction: 2 cullingMode: 0 @@ -146,7 +146,7 @@ ParticleSystem: startDelay: serializedVersion: 2 minMaxState: 0 - scalar: 0 + scalar: 2 minScalar: 0 maxCurve: serializedVersion: 2 @@ -206,8 +206,8 @@ ParticleSystem: startLifetime: serializedVersion: 2 minMaxState: 3 - scalar: 15 - minScalar: 10 + scalar: 10 + minScalar: 5 maxCurve: serializedVersion: 2 m_Curve: @@ -313,7 +313,7 @@ ParticleSystem: serializedVersion: 2 minMaxState: 0 minColor: {r: 1, g: 1, b: 1, a: 1} - maxColor: {r: 0.2679245, g: 0.2679245, b: 0.2679245, a: 1} + maxColor: {r: 1, g: 1, b: 1, a: 0.5254902} maxGradient: serializedVersion: 2 key0: {r: 1, g: 1, b: 1, a: 1} @@ -535,7 +535,7 @@ ParticleSystem: m_RotationOrder: 4 startRotationX: serializedVersion: 2 - minMaxState: 0 + minMaxState: 3 scalar: 0 minScalar: 0 maxCurve: @@ -588,7 +588,7 @@ ParticleSystem: m_RotationOrder: 4 startRotationY: serializedVersion: 2 - minMaxState: 0 + minMaxState: 3 scalar: 0 minScalar: 0 maxCurve: @@ -641,8 +641,8 @@ ParticleSystem: m_RotationOrder: 4 startRotation: serializedVersion: 2 - minMaxState: 0 - scalar: 0 + minMaxState: 3 + scalar: 6.283185 minScalar: 0 maxCurve: serializedVersion: 2 @@ -701,7 +701,7 @@ ParticleSystem: gravityModifier: serializedVersion: 2 minMaxState: 0 - scalar: 0 + scalar: 0.05 minScalar: 0 maxCurve: serializedVersion: 2 @@ -960,7 +960,7 @@ ParticleSystem: rateOverTime: serializedVersion: 2 minMaxState: 0 - scalar: 70 + scalar: 60 minScalar: 10 maxCurve: serializedVersion: 2 @@ -1398,17 +1398,17 @@ ParticleSystem: maxColor: {r: 1, g: 1, b: 1, a: 1} maxGradient: serializedVersion: 2 - key0: {r: 1, g: 1, b: 1, a: 1} - key1: {r: 1, g: 1, b: 1, a: 0} - key2: {r: 0, g: 0, b: 0, a: 0} + key0: {r: 1, g: 0, b: 0, a: 1} + key1: {r: 0.6981132, g: 0.34299576, b: 0.07244563, a: 0} + key2: {r: 0.2679245, g: 0.2679245, b: 0.2679245, a: 1} key3: {r: 0, g: 0, b: 0, a: 0} key4: {r: 0, g: 0, b: 0, a: 0} key5: {r: 0, g: 0, b: 0, a: 0} key6: {r: 0, g: 0, b: 0, a: 0} key7: {r: 0, g: 0, b: 0, a: 0} ctime0: 0 - ctime1: 65535 - ctime2: 0 + ctime1: 1604 + ctime2: 9598 ctime3: 0 ctime4: 0 ctime5: 0 @@ -1416,7 +1416,7 @@ ParticleSystem: ctime7: 0 atime0: 0 atime1: 65535 - atime2: 0 + atime2: 4071 atime3: 0 atime4: 0 atime5: 0 @@ -1424,7 +1424,7 @@ ParticleSystem: atime7: 0 m_Mode: 0 m_ColorSpace: 0 - m_NumColorKeys: 2 + m_NumColorKeys: 3 m_NumAlphaKeys: 2 minGradient: serializedVersion: 2 diff --git a/Assets/Scenes/Gameplay.unity b/Assets/Scenes/Gameplay.unity index 6af3064..e5c9b4e 100644 --- a/Assets/Scenes/Gameplay.unity +++ b/Assets/Scenes/Gameplay.unity @@ -8111,7 +8111,8 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: - - {fileID: 1331867752} + - {fileID: 896163321} + - {fileID: 1525768528} - {fileID: 2144880610} m_Father: {fileID: 1800055494} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -8132,7 +8133,8 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 6cf3520d5a751734fa422fe3962055ac, type: 3} m_Name: m_EditorClassIdentifier: Assembly-CSharp::AmmoScreenView - ReloadBar: {fileID: 1331867753} + TorpedoReloadBar: {fileID: 1331867753} + MissileReloadBar: {fileID: 1475905540} FillMaxSpeed: 14 TorpedoAmmoLabel: {fileID: 41323151} MissileAmmoLabel: {fileID: 99217483} @@ -18048,6 +18050,57 @@ Transform: m_Children: [] m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 180, y: 0, z: 0} +--- !u!1 &896163320 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 896163321} + - component: {fileID: 896163322} + m_Layer: 6 + m_Name: TorpedoBarMask + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &896163321 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 896163320} + 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: 1331867752} + m_Father: {fileID: 562622491} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 67} + m_Pivot: {x: 0.5, y: 1} +--- !u!114 &896163322 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 896163320} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3312d7739989d2b4e91e6319e9a96d76, type: 3} + m_Name: + m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.RectMask2D + m_Padding: {x: 0, y: 0, z: 0, w: 0} + m_Softness: {x: 0, y: 0} --- !u!1 &908404488 GameObject: m_ObjectHideFlags: 0 @@ -22520,7 +22573,7 @@ GameObject: - component: {fileID: 1331867754} - component: {fileID: 1331867753} m_Layer: 6 - m_Name: ReloadBar + m_Name: TorpedoReloadBar m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -22533,16 +22586,16 @@ RectTransform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1331867751} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + 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: 562622491} + m_Father: {fileID: 896163321} 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.1385, y: 0} + m_AnchoredPosition: {x: 0.1385, y: -32.450317} m_SizeDelta: {x: 302.5799, y: 103} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1331867753 @@ -29227,6 +29280,81 @@ MonoBehaviour: Win: {fileID: 1985257985} Loose: {fileID: 940977348} Completed: {fileID: 891512407} +--- !u!1 &1475905538 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1475905539} + - component: {fileID: 1475905541} + - component: {fileID: 1475905540} + m_Layer: 6 + m_Name: MissileReloadBar + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1475905539 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1475905538} + 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: 1525768528} + 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.1385, y: 32.400513} + m_SizeDelta: {x: 302.5799, y: 103} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1475905540 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1475905538} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Image + 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: 262c1e1617d160a4c84ebd7ac1dafd65, type: 3} + m_Type: 3 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 0 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!222 &1475905541 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1475905538} + m_CullTransparentMesh: 1 --- !u!1 &1485513323 GameObject: m_ObjectHideFlags: 0 @@ -29641,6 +29769,57 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1524953970} m_CullTransparentMesh: 1 +--- !u!1 &1525768527 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1525768528} + - component: {fileID: 1525768529} + m_Layer: 6 + m_Name: MissileBarMask + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1525768528 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1525768527} + 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: 1475905539} + m_Father: {fileID: 562622491} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 67} + m_Pivot: {x: 0.5, y: 0} +--- !u!114 &1525768529 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1525768527} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3312d7739989d2b4e91e6319e9a96d76, type: 3} + m_Name: + m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.RectMask2D + m_Padding: {x: 0, y: 0, z: 0, w: 0} + m_Softness: {x: 0, y: 0} --- !u!1 &1530765402 GameObject: m_ObjectHideFlags: 0 @@ -35657,10 +35836,11 @@ MonoBehaviour: Ammo: 6 lifetime: 20 damage: 10 - riseSpeed: 15 + riseSpeed: 80 pursueSpeed: 25 - intermediateOffset: {x: 0, y: 100, z: 0} + intermediateOffset: {x: 0, y: 200, z: 0} aim: {fileID: 461917476} + ReloadInterval: 4 --- !u!1 &1997120112 GameObject: m_ObjectHideFlags: 0 @@ -37691,7 +37871,7 @@ Transform: serializedVersion: 2 m_LocalRotation: {x: 0, y: 0.7072302, z: 0.7069834, w: 0} m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 0.87, y: 914.9, z: 100} + m_LocalScale: {x: 30, y: 50000, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 50587016} @@ -37706,7 +37886,7 @@ Transform: serializedVersion: 2 m_LocalRotation: {x: 0, y: 0.7072302, z: 0.7069834, w: 0} m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 27.7, y: 914.9, z: 100} + m_LocalScale: {x: 1026, y: 50000, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 50587016} diff --git a/Assets/Scripts/Gameplay/Core/UI/AmmoScreenView.cs b/Assets/Scripts/Gameplay/Core/UI/AmmoScreenView.cs index e22a5d9..26e4e57 100644 --- a/Assets/Scripts/Gameplay/Core/UI/AmmoScreenView.cs +++ b/Assets/Scripts/Gameplay/Core/UI/AmmoScreenView.cs @@ -4,7 +4,8 @@ using UnityEngine.UI; public class AmmoScreenView : MonoBehaviour { - [SerializeField] private Image ReloadBar; + [SerializeField] private Image TorpedoReloadBar; + [SerializeField] private Image MissileReloadBar; [SerializeField] private float FillMaxSpeed = 10; [SerializeField] private TextMeshProUGUI TorpedoAmmoLabel; @@ -44,9 +45,16 @@ public class AmmoScreenView : MonoBehaviour //Расчет отображения прогресса перезарядки float delta = FillMaxSpeed * Time.deltaTime; - float targetFillAmount = 1 - model.CurrentWeapon.ReloadPercent; - float progress = Mathf.MoveTowards(ReloadBar.fillAmount, targetFillAmount, delta); + ProcessBar(TorpedoReloadBar, delta, G.WeaponModel.Weapons[0].ReloadPercent); + ProcessBar(MissileReloadBar, delta, G.WeaponModel.Weapons[1].ReloadPercent); - ReloadBar.fillAmount = progress; + } + + private void ProcessBar(Image bar, float delta, float targetPercent) + { + float targetFillAmount = 1 - targetPercent; + //float progress = Mathf.MoveTowards(bar.fillAmount, targetFillAmount, delta); + //bar.fillAmount = progress; + bar.fillAmount = targetFillAmount; } } diff --git a/Assets/Scripts/Gameplay/Core/Weapons/MissileWeapon.cs b/Assets/Scripts/Gameplay/Core/Weapons/MissileWeapon.cs index b691e7c..2318930 100644 --- a/Assets/Scripts/Gameplay/Core/Weapons/MissileWeapon.cs +++ b/Assets/Scripts/Gameplay/Core/Weapons/MissileWeapon.cs @@ -12,11 +12,14 @@ public class MissileWeapon : Weapon [Header("Прицел")] [SerializeField] private AimBase aim; + [Header("Настройки оружия")] + [SerializeField] float ReloadInterval = 4; + private Missile activeMissile; private Transform currentTarget; - public override bool CanShoot => activeMissile == null && Ammo > 0 && currentTarget != null; - public override float ReloadPercent => CanShoot ? 1 : 0; + public override bool CanShoot => Ammo > 0 && Time.time - LastShootTime > ReloadInterval && currentTarget != null; + public override float ReloadPercent => (Time.time - LastShootTime) / ReloadInterval; private void Update() { @@ -48,7 +51,7 @@ public class MissileWeapon : Weapon damage: damage ); - missile.OnMissileDestroyed += OnMissileDestroyed; + //missile.OnMissileDestroyed += OnMissileDestroyed; PerformShoot(missile); } else @@ -58,14 +61,14 @@ public class MissileWeapon : Weapon } } - private void OnMissileDestroyed(Missile missile) - { - if (activeMissile == missile) - { - activeMissile = null; - missile.OnMissileDestroyed -= OnMissileDestroyed; - } - } + //private void OnMissileDestroyed(Missile missile) + //{ + // if (activeMissile == missile) + // { + // activeMissile = null; + // missile.OnMissileDestroyed -= OnMissileDestroyed; + // } + //} private void OnDrawGizmos() { diff --git a/Assets/Scripts/Gameplay/Core/Weapons/Weapon.cs b/Assets/Scripts/Gameplay/Core/Weapons/Weapon.cs index 1a510ad..c125b6f 100644 --- a/Assets/Scripts/Gameplay/Core/Weapons/Weapon.cs +++ b/Assets/Scripts/Gameplay/Core/Weapons/Weapon.cs @@ -10,7 +10,7 @@ public abstract class Weapon : MonoBehaviour [SerializeField] protected GameObject Owner; [SerializeField] protected AudioSource ShootAudio; public int Ammo = 20; - protected float LastShootTime = 0; + protected float LastShootTime = -1000; //События public event Action OnShoot;