Refactorisation
This commit is contained in:
@@ -5,13 +5,13 @@ using UnityEngine.SceneManagement;
|
||||
public class EndScene : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private TMP_Text mayorsText, minautorsText, bringerOfDeathText;
|
||||
private TMP_Text _mayorsText, _minautorsText, _bringerOfDeathText;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
mayorsText.SetText($"Mayors killed: {GameManager.MayorKills}");
|
||||
minautorsText.SetText($"Minautors killed: {GameManager.MinautorKills}");
|
||||
bringerOfDeathText.SetText($"Bringers of Death killed: {GameManager.BringerOfDeathKills}");
|
||||
_mayorsText.SetText($"Mayors killed: {GameManager.MayorKills}");
|
||||
_minautorsText.SetText($"Minautors killed: {GameManager.MinautorKills}");
|
||||
_bringerOfDeathText.SetText($"Bringers of Death killed: {GameManager.BringerOfDeathKills}");
|
||||
}
|
||||
|
||||
public void RestartGame()
|
||||
|
||||
@@ -45,8 +45,8 @@ public class PauseMenu : MonoBehaviour
|
||||
_beamDamages.SetText($"Beam Damages: {_manager.BeamDamages}");
|
||||
_beamFrequency.SetText($"Beam Frequency: {_manager.BeamFrequency}s");
|
||||
_beamLife.SetText($"Beam Life: {_manager.BeamLife}s");
|
||||
_horizontalBeam.SetText($"Horizontal Beam: {(Convert.ToBoolean(_manager.laserOnX) ? "Yes" : "No")}");
|
||||
_verticalBeam.SetText($"Vertical Beam: {(Convert.ToBoolean(_manager.laserOnY) ? "Yes": "No")}");
|
||||
_horizontalBeam.SetText($"Horizontal Beam: {(Convert.ToBoolean(_manager.HorizontalBeam) ? "Yes" : "No")}");
|
||||
_verticalBeam.SetText($"Vertical Beam: {(Convert.ToBoolean(_manager.VerticalBeam) ? "Yes": "No")}");
|
||||
_swordDamages.SetText($"Sword Damages: {_manager.SwordsDamages}");
|
||||
_swordQuantity.SetText($"Swords Quantity: {_manager.SwordsQuantity}");
|
||||
_swordHaloRadius.SetText($"Sword Halo Radius: {_manager.SwordsHaloRadius * 1.5}m");
|
||||
|
||||
@@ -6,7 +6,7 @@ using UnityEngine;
|
||||
public class StartUI : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private TMP_Text text;
|
||||
private TMP_Text _text;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
@@ -21,9 +21,9 @@ public class StartUI : MonoBehaviour
|
||||
private IEnumerator Settlement()
|
||||
{
|
||||
yield return new WaitForSecondsRealtime(1f);
|
||||
text.SetText("2");
|
||||
_text.SetText("2");
|
||||
yield return new WaitForSecondsRealtime(1f);
|
||||
text.SetText("1");
|
||||
_text.SetText("1");
|
||||
yield return new WaitForSecondsRealtime(1f);
|
||||
Time.timeScale = 1f;
|
||||
Destroy(gameObject);
|
||||
|
||||
@@ -191,7 +191,7 @@ Canvas:
|
||||
m_OverridePixelPerfect: 0
|
||||
m_SortingBucketNormalizedSize: 0
|
||||
m_VertexColorAlwaysGammaSpace: 1
|
||||
m_AdditionalShaderChannelsFlag: 0
|
||||
m_AdditionalShaderChannelsFlag: 25
|
||||
m_UpdateRectTransformForStandalone: 0
|
||||
m_SortingLayerID: 0
|
||||
m_SortingOrder: 0
|
||||
@@ -281,4 +281,4 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 4bbb960039366744fb92e6242d1a345d, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
text: {fileID: 2676709033308988721}
|
||||
_text: {fileID: 2676709033308988721}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
@@ -11,7 +10,7 @@ using Random = UnityEngine.Random;
|
||||
public class UpgradeScreen : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private List<Button> buttons = new();
|
||||
private List<Button> _buttons = new();
|
||||
|
||||
private Upgrade[] _upgrades;
|
||||
private PlayerManager _manager;
|
||||
@@ -26,7 +25,7 @@ public class UpgradeScreen : MonoBehaviour
|
||||
|
||||
public void GenerateChoice()
|
||||
{
|
||||
Upgrade[] choosen = new Upgrade[buttons.Count];
|
||||
Upgrade[] choosen = new Upgrade[_buttons.Count];
|
||||
|
||||
while (choosen.Length != choosen.Distinct().Count())
|
||||
{
|
||||
@@ -34,7 +33,7 @@ public class UpgradeScreen : MonoBehaviour
|
||||
{
|
||||
Upgrade choosenUpgrade = _upgrades[Random.Range(0, _upgrades.Length)];
|
||||
|
||||
bool beamCondition = (choosenUpgrade.paramName == "laserOnX" && _manager.laserOnX >= 1) || (choosenUpgrade.paramName == "laserOnY" && _manager.laserOnY >= 1);
|
||||
bool beamCondition = (choosenUpgrade.paramName == "HorizontalBeam" && _manager.HorizontalBeam >= 1) || (choosenUpgrade.paramName == "VerticalBeam" && _manager.VerticalBeam >= 1);
|
||||
bool beamFrequencyCondition = (choosenUpgrade.paramName == "BeamFrequency" && _manager.BeamFrequency <= 0);
|
||||
bool arrowFrequency = (choosenUpgrade.paramName == "ArrowFrequency" && _manager.ArrowFrequency <= 0.5f);
|
||||
|
||||
@@ -42,7 +41,7 @@ public class UpgradeScreen : MonoBehaviour
|
||||
{
|
||||
choosenUpgrade = _upgrades[Random.Range(0, _upgrades.Length)];
|
||||
|
||||
beamCondition = (choosenUpgrade.paramName == "laserOnX" && _manager.laserOnX >= 1) || (choosenUpgrade.paramName == "laserOnY" && _manager.laserOnY >= 1);
|
||||
beamCondition = (choosenUpgrade.paramName == "HorizontalBeam" && _manager.HorizontalBeam >= 1) || (choosenUpgrade.paramName == "VerticalBeam" && _manager.VerticalBeam >= 1);
|
||||
beamFrequencyCondition = (choosenUpgrade.paramName == "BeamFrequency" && _manager.BeamFrequency <= 0);
|
||||
arrowFrequency = (choosenUpgrade.paramName == "ArrowFrequency" && _manager.ArrowFrequency <= 0.5f);
|
||||
};
|
||||
@@ -51,7 +50,7 @@ public class UpgradeScreen : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var button in buttons.Select((value, i) => new {i, value}))
|
||||
foreach (var button in _buttons.Select((value, i) => new {i, value}))
|
||||
{
|
||||
button.value.GetComponentInChildren<TMP_Text>().SetText(choosen[button.i].name);
|
||||
button.value.GetComponent<Button>().onClick.AddListener(() => { UpgradePlayer(button.value, _upgrades, _manager); });
|
||||
|
||||
@@ -46,7 +46,7 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 9e0d6eae981931e49af7552730883326, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
buttons:
|
||||
_buttons:
|
||||
- {fileID: 84359638430006894}
|
||||
- {fileID: 6549512925133430735}
|
||||
- {fileID: 451137559467290092}
|
||||
@@ -62,7 +62,7 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 132f6eb0a04c6614d9ebb227a443e2a6, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
upgradesJSON: {fileID: 4900000, guid: aaa2ab8454f62084e836d4c194574793, type: 3}
|
||||
_upgradesJSON: {fileID: 4900000, guid: aaa2ab8454f62084e836d4c194574793, type: 3}
|
||||
upgrades:
|
||||
upgrades: []
|
||||
--- !u!1 &587910270085467340
|
||||
|
||||
Reference in New Issue
Block a user