Clean GameManager & UpgradeBase variable names

This commit is contained in:
Denis-Cosmin Nutiu 2019-08-31 11:49:41 +03:00
parent 649a0f7b59
commit 5e6c27b672
8 changed files with 12 additions and 14 deletions

View file

@ -8,13 +8,11 @@ namespace src.Base
{ {
public class UpgradeBase : GameplayComponent, IUpgrade public class UpgradeBase : GameplayComponent, IUpgrade
{ {
protected GameManager gameManager;
private UpgradeManager _upgradeManager; private UpgradeManager _upgradeManager;
protected PlayerController _playerToUpgrade; protected PlayerController PlayerToUpgrade;
public void Start() public void Start()
{ {
gameManager = GameManager.instance;
_upgradeManager = UpgradeManager.instance; _upgradeManager = UpgradeManager.instance;
} }
@ -26,7 +24,7 @@ namespace src.Base
public void OnTriggerEnter2D(Collider2D other) public void OnTriggerEnter2D(Collider2D other)
{ {
if (!other.CompareTag("Player")) return; if (!other.CompareTag("Player")) return;
_playerToUpgrade = other.GetComponent<PlayerController>(); PlayerToUpgrade = other.GetComponent<PlayerController>();
PerformUpgrade(); PerformUpgrade();
_upgradeManager.ClaimUpgrade(gameObject); _upgradeManager.ClaimUpgrade(gameObject);
Destroy(gameObject); Destroy(gameObject);

View file

@ -9,7 +9,7 @@ namespace src.Managers
{ {
public class GameManager : MonoBehaviour public class GameManager : MonoBehaviour
{ {
public static GameManager instance; public static GameManager Instance;
// Inner Components // Inner Components
private PlayerController _playerController; private PlayerController _playerController;
@ -19,11 +19,11 @@ namespace src.Managers
public void Awake() public void Awake()
{ {
if (instance == null) if (Instance == null)
{ {
instance = this; Instance = this;
} }
else if (instance != null) else if (Instance != null)
{ {
Destroy(gameObject); Destroy(gameObject);
} }

View file

@ -7,7 +7,7 @@ namespace src.Upgrade
{ {
public override void PerformUpgrade() public override void PerformUpgrade()
{ {
var bombManager = _playerToUpgrade.GetComponent<BombsUtilManager>(); var bombManager = PlayerToUpgrade.GetComponent<BombsUtilManager>();
bombManager.IncreasePower(); bombManager.IncreasePower();
} }
} }

View file

@ -7,7 +7,7 @@ namespace src.Upgrade
{ {
public override void PerformUpgrade() public override void PerformUpgrade()
{ {
var bombManager = _playerToUpgrade.GetComponent<BombsUtilManager>(); var bombManager = PlayerToUpgrade.GetComponent<BombsUtilManager>();
bombManager.IncreaseAllowedBombs(); bombManager.IncreaseAllowedBombs();
} }
} }

View file

@ -8,7 +8,7 @@ namespace src.Upgrade
{ {
public override void PerformUpgrade() public override void PerformUpgrade()
{ {
var bombManager = _playerToUpgrade.GetComponent<BombsUtilManager>(); var bombManager = PlayerToUpgrade.GetComponent<BombsUtilManager>();
bombManager.IncreaseAllowedBombs(); bombManager.IncreaseAllowedBombs();
bombManager.IncreasePower(); bombManager.IncreasePower();
} }

View file

@ -7,7 +7,7 @@ namespace src.Upgrade
{ {
public override void PerformUpgrade() public override void PerformUpgrade()
{ {
var player = _playerToUpgrade.GetComponent<PlayerUpgrade>(); var player = PlayerToUpgrade.GetComponent<PlayerUpgrade>();
player.IncreaseSpeed(.5f); player.IncreaseSpeed(.5f);
} }
} }

View file

@ -16,7 +16,7 @@ namespace src.Wall
private void Start() private void Start()
{ {
_upgradeManager = GameManager.instance.GetUpgradeManager(); _upgradeManager = GameManager.Instance.GetUpgradeManager();
_explosionPrefab = PrefabAtlas.BombExplosion; _explosionPrefab = PrefabAtlas.BombExplosion;
_exitDoorPrefab = PrefabAtlas.ExitDoor; _exitDoorPrefab = PrefabAtlas.ExitDoor;
} }

View file

@ -12,7 +12,7 @@ namespace src.Wall
private void Start() private void Start()
{ {
_gameManager = GameManager.instance; _gameManager = GameManager.Instance;
} }
/* Trigger the next level and destroy itself. */ /* Trigger the next level and destroy itself. */