diff --git a/Assets/Scripts/Fighters/Bandit.asset b/Assets/Scripts/Store/Bandit.asset similarity index 100% rename from Assets/Scripts/Fighters/Bandit.asset rename to Assets/Scripts/Store/Bandit.asset diff --git a/Assets/Scripts/Fighters/Bandit.asset.meta b/Assets/Scripts/Store/Bandit.asset.meta similarity index 100% rename from Assets/Scripts/Fighters/Bandit.asset.meta rename to Assets/Scripts/Store/Bandit.asset.meta diff --git a/Assets/EnemySpawnController.cs b/Assets/Scripts/Store/EnemySpawnController.cs similarity index 71% rename from Assets/EnemySpawnController.cs rename to Assets/Scripts/Store/EnemySpawnController.cs index 25e14dff025cd0c6b15bb05f32b2a65834b1db2f..b1c34b281b802d7b7e9b658cb96114b4fa12245a 100644 --- a/Assets/EnemySpawnController.cs +++ b/Assets/Scripts/Store/EnemySpawnController.cs @@ -3,15 +3,14 @@ using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; - public class EnemySpawnController : MonoBehaviour { + [SerializeField] List<Opponent> enemyList; [SerializeField] List<Image> enemySprites; - Dictionary<Opponent, Image> enemys = new Dictionary<Opponent, Image>(); + Dictionary<Opponent, Image> enemies = new Dictionary<Opponent, Image>(); - StatsManager statsManager; float mana; Opponent activeSpawn; @@ -20,36 +19,36 @@ public class EnemySpawnController : MonoBehaviour private void Awake() { - statsManager = FindObjectOfType<StatsManager>(); mana = -1; for (int i = 0; i < enemyList.Count; i++) { - enemys.Add(enemyList[i], enemySprites[i]); + enemies.Add(enemyList[i], enemySprites[i]); } } // Update is called once per frame void Update() { - if (mana != statsManager.GetMana()) + var actualMana = StatsManager.instance.GetMana(); + if (mana != actualMana) { - mana = statsManager.GetMana(); + mana = actualMana; ChangeActiveState(); } } void ChangeActiveState() { - foreach (KeyValuePair<Opponent, Image> enemy in enemys) + foreach (KeyValuePair<Opponent, Image> enemy in enemies) { if (enemy.Key.enemyCost > mana) { - enemy.Value.color = new Color(0.3f,0.3f,0.3f,1f); + enemy.Value.color = new Color(0.3f, 0.3f, 0.3f, 1f); } else { - enemy.Value.color = new Color(1f,1f,1f,1f); + enemy.Value.color = new Color(1f, 1f, 1f, 1f); } } } @@ -68,13 +67,13 @@ public class EnemySpawnController : MonoBehaviour public void OnEnemyMouseDown(string enemyName) { SetEnemyToSpawnObject(enemyName); - if (statsManager.ModifyMana(-1*(int)activeSpawn.enemyCost)) + if (StatsManager.instance.ModifyMana(-1 * (int)activeSpawn.enemyCost)) { dragObject.GetComponent<Image>().sprite = activeSpawn.EnemySprite; - enemyImage = Instantiate(dragObject, PositionPrefab(), Quaternion.identity,transform); + enemyImage = Instantiate(dragObject, PositionPrefab(), Quaternion.identity, transform); } } - + Vector3 PositionPrefab() { Vector3 pos = Camera.main.ScreenToWorldPoint(Input.mousePosition); @@ -95,6 +94,6 @@ public class EnemySpawnController : MonoBehaviour { Destroy(enemyImage); enemyImage = null; - Instantiate(activeSpawn.enemyPrefab,PositionPrefab(),Quaternion.identity); + Instantiate(activeSpawn.enemyPrefab, PositionPrefab(), Quaternion.identity); } } diff --git a/Assets/EnemySpawnController.cs.meta b/Assets/Scripts/Store/EnemySpawnController.cs.meta similarity index 100% rename from Assets/EnemySpawnController.cs.meta rename to Assets/Scripts/Store/EnemySpawnController.cs.meta diff --git a/Assets/Scripts/Fighters/Opponent.cs b/Assets/Scripts/Store/Opponent.cs similarity index 100% rename from Assets/Scripts/Fighters/Opponent.cs rename to Assets/Scripts/Store/Opponent.cs diff --git a/Assets/Scripts/Fighters/Opponent.cs.meta b/Assets/Scripts/Store/Opponent.cs.meta similarity index 100% rename from Assets/Scripts/Fighters/Opponent.cs.meta rename to Assets/Scripts/Store/Opponent.cs.meta diff --git a/Assets/SpawnEnemy.cs b/Assets/Scripts/Store/SpawnEnemy.cs similarity index 100% rename from Assets/SpawnEnemy.cs rename to Assets/Scripts/Store/SpawnEnemy.cs diff --git a/Assets/SpawnEnemy.cs.meta b/Assets/Scripts/Store/SpawnEnemy.cs.meta similarity index 100% rename from Assets/SpawnEnemy.cs.meta rename to Assets/Scripts/Store/SpawnEnemy.cs.meta diff --git a/Assets/Scripts/Fighters/Tank.asset b/Assets/Scripts/Store/Tank.asset similarity index 100% rename from Assets/Scripts/Fighters/Tank.asset rename to Assets/Scripts/Store/Tank.asset diff --git a/Assets/Scripts/Fighters/Tank.asset.meta b/Assets/Scripts/Store/Tank.asset.meta similarity index 100% rename from Assets/Scripts/Fighters/Tank.asset.meta rename to Assets/Scripts/Store/Tank.asset.meta