diff --git a/Assets/GWConquest/Scenes/GalaxyMap.unity b/Assets/GWConquest/Scenes/GalaxyMap.unity index 54922a6..758a5b0 100644 --- a/Assets/GWConquest/Scenes/GalaxyMap.unity +++ b/Assets/GWConquest/Scenes/GalaxyMap.unity @@ -28409,7 +28409,9 @@ MonoBehaviour: BetweenTransitionLengthFactor: 60 battleTurnLength: 30 battleTurnDeviation: 10 - battlePreparingCooldown: 30 + battleBeginPhaseLength: 0 + battleCommandPhaseLength: 20 + battleCombatPhaseLength: 20 moveToFlankCooldown: 15 moveToReserveCooldown: 15 unitDeathCooldown: 60 @@ -46406,7 +46408,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 0 + m_IsActive: 1 --- !u!224 &765894939 RectTransform: m_ObjectHideFlags: 0 @@ -61803,12 +61805,12 @@ PrefabInstance: - target: {fileID: 77748483005084366, guid: f69b4b94559d7a14d99e0d870647c1f9, type: 3} propertyPath: m_AnchorMax.x - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 77748483005084366, guid: f69b4b94559d7a14d99e0d870647c1f9, type: 3} propertyPath: m_AnchorMax.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 77748483005084366, guid: f69b4b94559d7a14d99e0d870647c1f9, type: 3} @@ -62230,6 +62232,11 @@ PrefabInstance: propertyPath: m_AnchoredPosition.x value: 28.300781 objectReference: {fileID: 0} + - target: {fileID: 4175708910377210784, guid: f69b4b94559d7a14d99e0d870647c1f9, + type: 3} + propertyPath: m_AnchoredPosition.x + value: 10 + objectReference: {fileID: 0} - target: {fileID: 4437373468136562986, guid: f69b4b94559d7a14d99e0d870647c1f9, type: 3} propertyPath: m_AnchoredPosition.x @@ -124479,7 +124486,7 @@ RectTransform: m_AnchorMin: {x: 0.5, y: 1} m_AnchorMax: {x: 0.5, y: 1} m_AnchoredPosition: {x: 0, y: -107.51172} - m_SizeDelta: {x: 115, y: 40.225113} + m_SizeDelta: {x: 0, y: 40.225113} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1981011823 MonoBehaviour: @@ -125581,7 +125588,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 0 + m_IsActive: 1 --- !u!224 &1996625630 RectTransform: m_ObjectHideFlags: 0 @@ -133019,12 +133026,12 @@ PrefabInstance: - target: {fileID: 77748483005084366, guid: f69b4b94559d7a14d99e0d870647c1f9, type: 3} propertyPath: m_AnchorMax.x - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 77748483005084366, guid: f69b4b94559d7a14d99e0d870647c1f9, type: 3} propertyPath: m_AnchorMax.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 77748483005084366, guid: f69b4b94559d7a14d99e0d870647c1f9, type: 3} @@ -133311,6 +133318,11 @@ PrefabInstance: propertyPath: m_AnchoredPosition.x value: 28.300781 objectReference: {fileID: 0} + - target: {fileID: 4175708910377210784, guid: f69b4b94559d7a14d99e0d870647c1f9, + type: 3} + propertyPath: m_AnchoredPosition.x + value: 10 + objectReference: {fileID: 0} - target: {fileID: 4437373468136562986, guid: f69b4b94559d7a14d99e0d870647c1f9, type: 3} propertyPath: m_AnchoredPosition.x diff --git a/Assets/GWConquest/Scripts/Battle.cs b/Assets/GWConquest/Scripts/Battle.cs index 1c6b2f9..41cf060 100644 --- a/Assets/GWConquest/Scripts/Battle.cs +++ b/Assets/GWConquest/Scripts/Battle.cs @@ -140,6 +140,11 @@ namespace GWConquest private set => battlePhase.Value = value; } + public float PhaseCooldownPercent + { + get => PhaseCooldown / GameManager.Instance.GetBattlePhaseLength(Phase); + } + public Player Victor { get => Player.GetPlayerById(victorID.Value); @@ -174,8 +179,8 @@ namespace GWConquest public void Init() { - Phase = BattlePhase.Command; - PhaseCooldown = GameManager.Instance.BattleCommandPhaseLength; + Phase = BattlePhase.Begin; + PhaseCooldown = GameManager.Instance.GetBattlePhaseLength(BattlePhase.Begin); flankCount.Value = Zone.zoneType == ZoneType.Ground ? 3 : 1; int maxUnitPerFlank = Zone.zoneType == ZoneType.Ground ? 29 : 86; @@ -230,7 +235,7 @@ namespace GWConquest public void OnFormationsChanged() { - var ui = FindObjectOfType(); + var ui = FindAnyObjectByType(); if (ui != null && ui.isActiveAndEnabled) { ui.UpdateFormations(); @@ -783,6 +788,7 @@ namespace GWConquest public enum BattlePhase { + Begin, Command, Combat, Finished diff --git a/Assets/GWConquest/Scripts/GameManager.cs b/Assets/GWConquest/Scripts/GameManager.cs index dfe6718..32e9b0f 100644 --- a/Assets/GWConquest/Scripts/GameManager.cs +++ b/Assets/GWConquest/Scripts/GameManager.cs @@ -27,12 +27,27 @@ namespace GWConquest private float battleTurnDeviation; public float BattleTurnDeviation { get => battleTurnDeviation * TimeScale; } + [SerializeField] + private float battleBeginPhaseLength; [SerializeField] private float battleCommandPhaseLength; - public float BattleCommandPhaseLength { get => battleCommandPhaseLength * TimeScale; } [SerializeField] private float battleCombatPhaseLength; - public float BattleCombatPhaseLength { get => battleCombatPhaseLength * TimeScale; } + + public float GetBattlePhaseLength(BattlePhase phase) + { + switch(phase) + { + case BattlePhase.Begin: + return battleBeginPhaseLength * TimeScale; + case BattlePhase.Command: + return battleCommandPhaseLength * TimeScale; + case BattlePhase.Combat: + return battleCombatPhaseLength * TimeScale; + default: + return 0f; + } + } [SerializeField] private float moveToFlankCooldown; diff --git a/Assets/GWConquest/Scripts/UI/BattleUI.cs b/Assets/GWConquest/Scripts/UI/BattleUI.cs index 1349e71..660f42c 100644 --- a/Assets/GWConquest/Scripts/UI/BattleUI.cs +++ b/Assets/GWConquest/Scripts/UI/BattleUI.cs @@ -64,14 +64,14 @@ namespace GWConquest [System.NonSerialized] public Unit SelectingTargetUnit; [System.NonSerialized] - public bool IsInPreparing = false; + public BattlePhase CurrentPhase = BattlePhase.Command; public void SetBattle(Battle battle) { Battle = battle; SelectingTarget = false; SelectingTargetUnit = null; - IsInPreparing = Battle.IsInPreparing; + CurrentPhase = Battle.Phase; InitFlankPanel(); @@ -82,7 +82,7 @@ namespace GWConquest FixedUpdate(); - if (Battle.IsInPreparing) + if (CurrentPhase == BattlePhase.Command) { SoundEffects.Instance.PlayMusic("MusicPreparing"); } @@ -94,7 +94,7 @@ namespace GWConquest public void Close() { - if (Battle.IsInPreparing) + if (CurrentPhase == BattlePhase.Command) { SoundEffects.Instance.StopMusic(); } @@ -263,24 +263,24 @@ namespace GWConquest private void Update() { - if (Battle.IsInPreparing) + if (Battle.Phase == BattlePhase.Command) { PreparingBarGO.SetActive(true); StrengthBarsGO.SetActive(false); - PreparingBar.fillAmount = 1f - Battle.PreparingCooldown / GameManager.Instance.BattlePreparingCooldown; + PreparingBar.fillAmount = 1f - Battle.PhaseCooldownPercent; } else { PreparingBarGO.SetActive(false); StrengthBarsGO.SetActive(true); - if (IsInPreparing) + if (CurrentPhase == BattlePhase.Command) { SoundEffects.Instance.StopMusic(); SoundEffects.Instance.PlayEffect("BattleStarting"); } } - IsInPreparing = Battle.IsInPreparing; + CurrentPhase = Battle.Phase; UpdateFormations(); UpdateIcons();