Refactorisation
This commit is contained in:
@@ -2,13 +2,13 @@ using UnityEngine;
|
||||
|
||||
public class UpgradesData : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private TextAsset upgradesJSON;
|
||||
[SerializeField] private TextAsset _upgradesJSON;
|
||||
|
||||
public Upgrades upgrades;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
upgrades = JsonUtility.FromJson<Upgrades>(upgradesJSON.text);
|
||||
upgrades = JsonUtility.FromJson<Upgrades>(_upgradesJSON.text);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ public class Ennemy : MonoBehaviour
|
||||
private SpriteRenderer _sr;
|
||||
private Transform _player;
|
||||
|
||||
public static float StartLife = 100;
|
||||
public static float StartLife = 100f;
|
||||
public float Life;
|
||||
public float Speed = .1f;
|
||||
public int Damages = 1;
|
||||
|
||||
+17
-13
@@ -39,8 +39,8 @@ Transform:
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 5162058273174827349}
|
||||
- {fileID: 4152598028236711869}
|
||||
- {fileID: 4740856695113674186}
|
||||
- {fileID: 1598670840411184170}
|
||||
- {fileID: 5865658617547034318}
|
||||
- {fileID: 749125587594098812}
|
||||
@@ -238,7 +238,7 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 32f5e7611866dce4ab320c814d279d84, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
lookOnRight: 1
|
||||
LookOnRight: 1
|
||||
--- !u!114 &7397454076540391921
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -273,14 +273,14 @@ MonoBehaviour:
|
||||
BeamDamages: 50
|
||||
BeamFrequency: 5
|
||||
BeamLife: 0.5
|
||||
HorizontalBeam: 0
|
||||
VerticalBeam: 0
|
||||
SwordsHaloRadius: 1
|
||||
SwordsDamages: 25
|
||||
SwordsQuantity: 5
|
||||
ArrowDamages: 15
|
||||
ArrowFrequency: 2
|
||||
ArrowRange: 5
|
||||
laserOnX: 0
|
||||
laserOnY: 0
|
||||
pauseMenu: {fileID: 1161238801143918071}
|
||||
deathScreen: {fileID: 8536456763282141865}
|
||||
_upgradeScreen: {fileID: 3552072345333957438}
|
||||
@@ -296,8 +296,8 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: ce23672c2f6b5bd42adf4a7776a52005, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
laser: {fileID: 4893257253370123985, guid: 95cb513377bf0e248bd66d6f7ddae920, type: 3}
|
||||
arrow: {fileID: 6280786298679187013, guid: 856a449688373494987701d49b79a7af, type: 3}
|
||||
_beam: {fileID: 4893257253370123985, guid: 95cb513377bf0e248bd66d6f7ddae920, type: 3}
|
||||
_arrow: {fileID: 6280786298679187013, guid: 856a449688373494987701d49b79a7af, type: 3}
|
||||
--- !u!114 &4761054675786854393
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -310,10 +310,10 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: e6db2d9573175344fa4455c70d440232, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
Mayor: {fileID: 0}
|
||||
Minautor: {fileID: 0}
|
||||
BringerOfDeath: {fileID: 0}
|
||||
--- !u!1001 &993819705047970090
|
||||
Mayor: {fileID: 6061697268588932327, guid: 797fec3354cfff54e95743a263e79f8f, type: 3}
|
||||
Minautor: {fileID: 1374640533067853523, guid: 5115e3c062ab0d94c993c9a01963c9bb, type: 3}
|
||||
BringerOfDeath: {fileID: 1631754574535955224, guid: 7339e2869a0a9d241b10f5d0a658ff4d, type: 3}
|
||||
--- !u!1001 &838647460435930549
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
@@ -323,7 +323,7 @@ PrefabInstance:
|
||||
m_Modifications:
|
||||
- target: {fileID: 3957911104700806788, guid: fd7d128113472244d88a3fc511da99a0, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: Halo
|
||||
value: Sword Halo
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5476423095808072928, guid: fd7d128113472244d88a3fc511da99a0, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
@@ -370,10 +370,10 @@ PrefabInstance:
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: fd7d128113472244d88a3fc511da99a0, type: 3}
|
||||
--- !u!4 &4740856695113674186 stripped
|
||||
--- !u!4 &5162058273174827349 stripped
|
||||
Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 5476423095808072928, guid: fd7d128113472244d88a3fc511da99a0, type: 3}
|
||||
m_PrefabInstance: {fileID: 993819705047970090}
|
||||
m_PrefabInstance: {fileID: 838647460435930549}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1001 &1611953582756194365
|
||||
PrefabInstance:
|
||||
@@ -631,6 +631,10 @@ PrefabInstance:
|
||||
propertyPath: m_Name
|
||||
value: Upgrade Screen
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 113215708914507097, guid: c16dc07d15aa39d4ba76ea86b13d279e, type: 3}
|
||||
propertyPath: m_IsActive
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4232304121047868955, guid: c16dc07d15aa39d4ba76ea86b13d279e, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0
|
||||
|
||||
@@ -17,6 +17,8 @@ public class PlayerManager : MonoBehaviour
|
||||
public float BeamDamages = 50f;
|
||||
public float BeamFrequency = 5f;
|
||||
public float BeamLife = 0.5f;
|
||||
public float HorizontalBeam = 0f;
|
||||
public float VerticalBeam = 0f;
|
||||
|
||||
public float SwordsHaloRadius = 1f;
|
||||
public float SwordsDamages = 25f;
|
||||
@@ -26,9 +28,6 @@ public class PlayerManager : MonoBehaviour
|
||||
public float ArrowFrequency = 2f;
|
||||
public float ArrowRange = 5f;
|
||||
|
||||
public float laserOnX = 0f;
|
||||
public float laserOnY = 0f;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject pauseMenu;
|
||||
[SerializeField]
|
||||
|
||||
@@ -7,7 +7,7 @@ public class PlayerMovements : MonoBehaviour
|
||||
private Animator _animator;
|
||||
private PlayerManager _pm;
|
||||
|
||||
public bool lookOnRight = true;
|
||||
public bool LookOnRight = true;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
@@ -28,11 +28,11 @@ public class PlayerMovements : MonoBehaviour
|
||||
if (moveH < 0)
|
||||
{
|
||||
_sr.flipX = true;
|
||||
lookOnRight = false;
|
||||
LookOnRight = false;
|
||||
} else if (moveH > 0)
|
||||
{
|
||||
_sr.flipX = false;
|
||||
lookOnRight = true;
|
||||
LookOnRight = true;
|
||||
}
|
||||
|
||||
/** --- update animator -------------------------------------------*/
|
||||
|
||||
@@ -4,28 +4,27 @@ using UnityEngine;
|
||||
[RequireComponent (typeof(PlayerMovements))]
|
||||
public class PlayerWeapons : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private GameObject laser;
|
||||
[SerializeField] private GameObject _beam;
|
||||
|
||||
[SerializeField] private GameObject arrow;
|
||||
[SerializeField] private GameObject _arrow;
|
||||
|
||||
private PlayerMovements _pm;
|
||||
private PlayerManager _manager;
|
||||
|
||||
private float oldBeamFrequency;
|
||||
private bool oldBeamX;
|
||||
private bool oldBeamY;
|
||||
private float _oldBeamFrequency;
|
||||
private bool _oldHorizontalBeam;
|
||||
private bool _oldVerticalBeam;
|
||||
|
||||
private float oldArrowFrequency;
|
||||
private float _oldArrowFrequency;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
_pm = GetComponent<PlayerMovements>();
|
||||
_manager = GetComponent<PlayerManager>();
|
||||
|
||||
oldBeamFrequency = _manager.BeamFrequency;
|
||||
oldBeamX = Convert.ToBoolean(_manager.laserOnX);
|
||||
oldBeamY = Convert.ToBoolean(_manager.laserOnY);
|
||||
oldArrowFrequency = _manager.ArrowFrequency;
|
||||
_oldArrowFrequency = _manager.BeamFrequency;
|
||||
_oldHorizontalBeam = Convert.ToBoolean(_manager.HorizontalBeam);
|
||||
_oldVerticalBeam = Convert.ToBoolean(_manager.VerticalBeam);
|
||||
|
||||
InvokeRepeating(nameof(ShootBeam), _manager.BeamFrequency, _manager.BeamFrequency);
|
||||
InvokeRepeating(nameof(ShootArrow), _manager.ArrowFrequency, _manager.ArrowFrequency);
|
||||
@@ -33,7 +32,7 @@ public class PlayerWeapons : MonoBehaviour
|
||||
|
||||
private void FixedUpdate()
|
||||
{
|
||||
if (_manager.BeamFrequency != oldBeamFrequency)
|
||||
if (_manager.BeamFrequency != _oldBeamFrequency)
|
||||
{
|
||||
if (_manager.BeamFrequency > 0f)
|
||||
{
|
||||
@@ -45,24 +44,24 @@ public class PlayerWeapons : MonoBehaviour
|
||||
CancelInvoke(nameof(ShootBeam));
|
||||
ShootBeam();
|
||||
}
|
||||
oldBeamFrequency = _manager.BeamFrequency;
|
||||
_oldBeamFrequency = _manager.BeamFrequency;
|
||||
}
|
||||
|
||||
if (_manager.BeamFrequency == 0)
|
||||
{
|
||||
if (oldBeamX != Convert.ToBoolean(_manager.laserOnX) || oldBeamY != Convert.ToBoolean(_manager.laserOnY))
|
||||
if (_oldHorizontalBeam != Convert.ToBoolean(_manager.HorizontalBeam) || _oldVerticalBeam != Convert.ToBoolean(_manager.VerticalBeam))
|
||||
{
|
||||
foreach (var beam in GameObject.FindGameObjectsWithTag("Beam"))
|
||||
{
|
||||
Destroy(beam);
|
||||
}
|
||||
oldBeamX = Convert.ToBoolean(_manager.laserOnX);
|
||||
oldBeamY = Convert.ToBoolean(_manager.laserOnY);
|
||||
_oldVerticalBeam = Convert.ToBoolean(_manager.VerticalBeam);
|
||||
_oldVerticalBeam = Convert.ToBoolean(_manager.VerticalBeam);
|
||||
ShootBeam();
|
||||
}
|
||||
}
|
||||
|
||||
if (_manager.ArrowFrequency != oldArrowFrequency)
|
||||
if (_manager.ArrowFrequency != _oldBeamFrequency)
|
||||
{
|
||||
CancelInvoke(nameof(ShootArrow));
|
||||
InvokeRepeating(nameof(ShootArrow), _manager.ArrowFrequency, _manager.ArrowFrequency);
|
||||
@@ -71,17 +70,17 @@ public class PlayerWeapons : MonoBehaviour
|
||||
|
||||
private void ShootBeam()
|
||||
{
|
||||
Instantiate(laser, transform.position, Quaternion.identity, transform);
|
||||
Instantiate(_beam, transform.position, Quaternion.identity, transform);
|
||||
|
||||
if (_manager.laserOnX > 0)
|
||||
if (_manager.HorizontalBeam > 0)
|
||||
{
|
||||
Instantiate(laser, transform.position, Quaternion.Euler(0, 0, 180), transform);
|
||||
Instantiate(_beam, transform.position, Quaternion.Euler(0, 0, 180), transform);
|
||||
}
|
||||
|
||||
if (_manager.laserOnY > 0)
|
||||
if (_manager.VerticalBeam > 0)
|
||||
{
|
||||
Instantiate(laser, transform.position, Quaternion.Euler(0, 0, 90), transform);
|
||||
Instantiate(laser, transform.position, Quaternion.Euler(0, 0, 270), transform);
|
||||
Instantiate(_beam, transform.position, Quaternion.Euler(0, 0, 90), transform);
|
||||
Instantiate(_beam, transform.position, Quaternion.Euler(0, 0, 270), transform);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -112,8 +111,8 @@ public class PlayerWeapons : MonoBehaviour
|
||||
// Shoot arrow
|
||||
if (target != null)
|
||||
{
|
||||
GameObject spawnedArrow = Instantiate(arrow, transform.position, Quaternion.identity);
|
||||
spawnedArrow.GetComponent<Arrow>().target = target;
|
||||
GameObject spawnedArrow = Instantiate(_arrow, transform.position, Quaternion.identity);
|
||||
spawnedArrow.GetComponent<Arrow>().Target = target;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,13 +10,13 @@ public class Spawner : MonoBehaviour
|
||||
|
||||
private float _radius = 5f;
|
||||
|
||||
[SerializeField] private int spawnedMayors = 0;
|
||||
[SerializeField] private int spawnedMinautor = 0;
|
||||
[SerializeField] private int spawnedBringerOfDeath = 0;
|
||||
private int _spawnedMayors = 0;
|
||||
private int _spawnedMinautor = 0;
|
||||
private int _spawnedBringerOfDeath = 0;
|
||||
|
||||
private readonly int mayorsLimit = 300;
|
||||
private readonly int minautorsLimit = 15;
|
||||
private readonly int bringerOfDeathLimit = 5;
|
||||
private readonly int _mayorsLimit = 300;
|
||||
private readonly int _minautorsLimit = 15;
|
||||
private readonly int _bringerOfDeathLimit = 5;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
@@ -36,9 +36,9 @@ public class Spawner : MonoBehaviour
|
||||
|
||||
private void Update()
|
||||
{
|
||||
spawnedMayors = Array.FindAll(GameObject.FindGameObjectsWithTag("Ennemy"), (value) => value.name.Contains("Mayor")).Length;
|
||||
spawnedMinautor = Array.FindAll(GameObject.FindGameObjectsWithTag("Ennemy"), (value) => value.name.Contains("Minautor")).Length;
|
||||
spawnedBringerOfDeath = Array.FindAll(GameObject.FindGameObjectsWithTag("Ennemy"), (value) => value.name.Contains("Bringer of Death")).Length;
|
||||
_spawnedMayors = Array.FindAll(GameObject.FindGameObjectsWithTag("Ennemy"), (value) => value.name.Contains("Mayor")).Length;
|
||||
_spawnedMinautor = Array.FindAll(GameObject.FindGameObjectsWithTag("Ennemy"), (value) => value.name.Contains("Minautor")).Length;
|
||||
_spawnedBringerOfDeath = Array.FindAll(GameObject.FindGameObjectsWithTag("Ennemy"), (value) => value.name.Contains("Bringer of Death")).Length;
|
||||
}
|
||||
|
||||
private void SpawnWave()
|
||||
@@ -54,9 +54,9 @@ public class Spawner : MonoBehaviour
|
||||
int retries = 0;
|
||||
|
||||
while (
|
||||
(enemyName == "Mayor" && spawnedMayors >= mayorsLimit) ||
|
||||
(enemyName == "Minautor" && spawnedMinautor >= minautorsLimit) ||
|
||||
(enemyName == "Bringer of Death" && spawnedBringerOfDeath >= bringerOfDeathLimit)
|
||||
(enemyName == "Mayor" && _spawnedMayors >= _mayorsLimit) ||
|
||||
(enemyName == "Minautor" && _spawnedMinautor >= _minautorsLimit) ||
|
||||
(enemyName == "Bringer of Death" && _spawnedBringerOfDeath >= _bringerOfDeathLimit)
|
||||
)
|
||||
{
|
||||
enemyToSpawn = ChooseEnemy();
|
||||
@@ -72,13 +72,13 @@ public class Spawner : MonoBehaviour
|
||||
switch (enemyName)
|
||||
{
|
||||
case "Mayor":
|
||||
spawnedMayors++;
|
||||
_spawnedMayors++;
|
||||
break;
|
||||
case "Minautor":
|
||||
spawnedMinautor++;
|
||||
_spawnedMinautor++;
|
||||
break;
|
||||
case "Bringer":
|
||||
spawnedBringerOfDeath++;
|
||||
_spawnedBringerOfDeath++;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -38,13 +38,13 @@
|
||||
},
|
||||
{
|
||||
"name": "2 Horizontal beams",
|
||||
"paramName": "laserOnX",
|
||||
"paramName": "HorizontalBeam",
|
||||
"maxValue": 1,
|
||||
"value": 1
|
||||
},
|
||||
{
|
||||
"name": "2 Vertical beams",
|
||||
"paramName": "laserOnY",
|
||||
"paramName": "VerticalBeam",
|
||||
"maxValue": 1,
|
||||
"value": 1
|
||||
},
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -2,7 +2,7 @@ using UnityEngine;
|
||||
|
||||
public class Arrow : MonoBehaviour
|
||||
{
|
||||
public GameObject target;
|
||||
public GameObject Target;
|
||||
|
||||
private PlayerManager _manager;
|
||||
|
||||
@@ -13,12 +13,12 @@ public class Arrow : MonoBehaviour
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (target == null)
|
||||
if (Target == null)
|
||||
{
|
||||
Destroy(gameObject);
|
||||
return;
|
||||
}
|
||||
transform.position = Vector3.MoveTowards(transform.position, target.transform.position, 20f * Time.deltaTime);
|
||||
transform.position = Vector3.MoveTowards(transform.position, Target.transform.position, 20f * Time.deltaTime);
|
||||
}
|
||||
|
||||
private void OnTriggerEnter2D(Collider2D collision)
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
|
||||
[RequireComponent (typeof(BoxCollider2D))]
|
||||
public class LaserBeam : MonoBehaviour
|
||||
public class Beam : MonoBehaviour
|
||||
{
|
||||
private PlayerManager _manager;
|
||||
private PlayerMovements _movements;
|
||||
@@ -20,9 +19,9 @@ public class LaserBeam : MonoBehaviour
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (_manager.laserOnX == 0)
|
||||
if (_manager.HorizontalBeam == 0)
|
||||
{
|
||||
if (!_movements.lookOnRight)
|
||||
if (!_movements.LookOnRight)
|
||||
{
|
||||
transform.rotation = Quaternion.Euler(0f, 180f, 0f);
|
||||
} else
|
||||
@@ -94,9 +94,9 @@ GameObject:
|
||||
m_Component:
|
||||
- component: {fileID: 4430932250055150325}
|
||||
- component: {fileID: 3148908794889564978}
|
||||
- component: {fileID: 1475843655422961594}
|
||||
- component: {fileID: 7468774557436471496}
|
||||
m_Layer: 0
|
||||
m_Name: Laser Beam
|
||||
m_Name: Beam
|
||||
m_TagString: Beam
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
@@ -163,7 +163,7 @@ BoxCollider2D:
|
||||
serializedVersion: 2
|
||||
m_Size: {x: 50, y: 0.16}
|
||||
m_EdgeRadius: 0
|
||||
--- !u!114 &1475843655422961594
|
||||
--- !u!114 &7468774557436471496
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
@@ -11,7 +11,7 @@ GameObject:
|
||||
- component: {fileID: 5476423095808072928}
|
||||
- component: {fileID: -8230784050683220836}
|
||||
m_Layer: 0
|
||||
m_Name: Halo
|
||||
m_Name: Sword Halo
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
|
Before Width: | Height: | Size: 224 B After Width: | Height: | Size: 224 B |
@@ -1,13 +1,13 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Halo : MonoBehaviour
|
||||
public class SwordHalo : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private GameObject _sword;
|
||||
|
||||
private PlayerManager _manager;
|
||||
private List<GameObject> swords = new();
|
||||
private List<GameObject> _swords = new();
|
||||
|
||||
private float _oldRadius;
|
||||
private int _oldSwordsCount;
|
||||
@@ -27,7 +27,7 @@ public class Halo : MonoBehaviour
|
||||
Quaternion.identity,
|
||||
transform
|
||||
);
|
||||
swords.Add(sword);
|
||||
_swords.Add(sword);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,9 +57,9 @@ public class Halo : MonoBehaviour
|
||||
{
|
||||
for (int i = 0; i < _oldSwordsCount; i++)
|
||||
{
|
||||
Destroy(swords[i]);
|
||||
Destroy(_swords[i]);
|
||||
}
|
||||
swords.Clear();
|
||||
_swords.Clear();
|
||||
|
||||
float angle = Mathf.PI * 2f / _manager.SwordsQuantity;
|
||||
for (int i = 0; i < _manager.SwordsQuantity; i++)
|
||||
@@ -70,7 +70,7 @@ public class Halo : MonoBehaviour
|
||||
Quaternion.identity,
|
||||
transform
|
||||
);
|
||||
swords.Add(sword);
|
||||
_swords.Add(sword);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,9 +78,9 @@ public class Halo : MonoBehaviour
|
||||
{
|
||||
for (int i = 0; i < _manager.SwordsQuantity; i++)
|
||||
{
|
||||
DestroyImmediate(swords[i]);
|
||||
DestroyImmediate(_swords[i]);
|
||||
}
|
||||
swords.Clear();
|
||||
_swords.Clear();
|
||||
|
||||
float angle = Mathf.PI * 2f / _manager.SwordsQuantity;
|
||||
for (int i = 0; i < _manager.SwordsQuantity; i++)
|
||||
@@ -91,7 +91,7 @@ public class Halo : MonoBehaviour
|
||||
Quaternion.identity,
|
||||
transform
|
||||
);
|
||||
swords.Add(sword);
|
||||
_swords.Add(sword);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user