diff --git a/Assets/Resources/Ammo.meta b/Assets/Resources/Items.meta similarity index 77% rename from Assets/Resources/Ammo.meta rename to Assets/Resources/Items.meta index 13b3734..336f9d9 100644 --- a/Assets/Resources/Ammo.meta +++ b/Assets/Resources/Items.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: bf3e6294c377ca84d82651fe870a56dc +guid: 142c20937b0ba4d1b9a77c8504dda487 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/Resources/Ammo/Bomb.prefab b/Assets/Resources/Items/Bomb.prefab similarity index 100% rename from Assets/Resources/Ammo/Bomb.prefab rename to Assets/Resources/Items/Bomb.prefab diff --git a/Assets/Resources/Ammo/Bomb.prefab.meta b/Assets/Resources/Items/Bomb.prefab.meta similarity index 100% rename from Assets/Resources/Ammo/Bomb.prefab.meta rename to Assets/Resources/Items/Bomb.prefab.meta diff --git a/Assets/Resources/Ammo/Explosion.prefab b/Assets/Resources/Items/BombExplosion.prefab similarity index 100% rename from Assets/Resources/Ammo/Explosion.prefab rename to Assets/Resources/Items/BombExplosion.prefab diff --git a/Assets/Resources/Ammo/Explosion.prefab.meta b/Assets/Resources/Items/BombExplosion.prefab.meta similarity index 100% rename from Assets/Resources/Ammo/Explosion.prefab.meta rename to Assets/Resources/Items/BombExplosion.prefab.meta diff --git a/Assets/Resources/Ammo/BombUpgrade.prefab b/Assets/Resources/Items/BombUpgrade.prefab similarity index 100% rename from Assets/Resources/Ammo/BombUpgrade.prefab rename to Assets/Resources/Items/BombUpgrade.prefab diff --git a/Assets/Resources/Ammo/BombUpgrade.prefab.meta b/Assets/Resources/Items/BombUpgrade.prefab.meta similarity index 100% rename from Assets/Resources/Ammo/BombUpgrade.prefab.meta rename to Assets/Resources/Items/BombUpgrade.prefab.meta diff --git a/Assets/Resources/Ammo/FlameUpgrade.prefab b/Assets/Resources/Items/FlameUpgrade.prefab similarity index 100% rename from Assets/Resources/Ammo/FlameUpgrade.prefab rename to Assets/Resources/Items/FlameUpgrade.prefab diff --git a/Assets/Resources/Ammo/FlameUpgrade.prefab.meta b/Assets/Resources/Items/FlameUpgrade.prefab.meta similarity index 100% rename from Assets/Resources/Ammo/FlameUpgrade.prefab.meta rename to Assets/Resources/Items/FlameUpgrade.prefab.meta diff --git a/Assets/Resources/Ammo/GoldenBombUpgrade.prefab b/Assets/Resources/Items/GoldenBombUpgrade.prefab similarity index 100% rename from Assets/Resources/Ammo/GoldenBombUpgrade.prefab rename to Assets/Resources/Items/GoldenBombUpgrade.prefab diff --git a/Assets/Resources/Ammo/GoldenBombUpgrade.prefab.meta b/Assets/Resources/Items/GoldenBombUpgrade.prefab.meta similarity index 100% rename from Assets/Resources/Ammo/GoldenBombUpgrade.prefab.meta rename to Assets/Resources/Items/GoldenBombUpgrade.prefab.meta diff --git a/Assets/Resources/Ammo/SpeedUpgrade.prefab b/Assets/Resources/Items/SpeedUpgrade.prefab similarity index 100% rename from Assets/Resources/Ammo/SpeedUpgrade.prefab rename to Assets/Resources/Items/SpeedUpgrade.prefab diff --git a/Assets/Resources/Ammo/SpeedUpgrade.prefab.meta b/Assets/Resources/Items/SpeedUpgrade.prefab.meta similarity index 100% rename from Assets/Resources/Ammo/SpeedUpgrade.prefab.meta rename to Assets/Resources/Items/SpeedUpgrade.prefab.meta diff --git a/Assets/Scripts/src/Ammo/BombController.cs b/Assets/Scripts/src/Ammo/BombController.cs index 8f4efa3..2dec22b 100644 --- a/Assets/Scripts/src/Ammo/BombController.cs +++ b/Assets/Scripts/src/Ammo/BombController.cs @@ -8,25 +8,24 @@ namespace src.Ammo { public class BombController : GameplayComponent, IExplosable { - public GameObject explosionPrefab; - - private BombCameraShake _cameraShake; private readonly BombsUtilManager _bombsUtil = BombsUtilManager.instance; + private BombCameraShake _cameraShake; + private SpriteRenderer _spriteRenderer; private bool _exploded; // Start is called before the first frame update - void Start() + private void Start() { _cameraShake = GameObject.Find("VCAM1").GetComponent(); + _spriteRenderer = GetComponentInChildren(); Invoke(nameof(Explode), _bombsUtil.timer); } - void Explode() + private void Explode() { - Instantiate(explosionPrefab, transform.position, Quaternion.identity); - - GetComponentInChildren().enabled = false; + Instantiate(PrefabAtlas.BombExplosion, transform.position, Quaternion.identity); + _spriteRenderer.enabled = false; _cameraShake.StartCameraShakeCoro(); StartCoroutine(CreateExplosions(Vector3.down)); StartCoroutine(CreateExplosions(Vector3.left)); @@ -49,8 +48,8 @@ namespace src.Ammo if (!hit.collider) { - Instantiate(explosionPrefab, transform.position + i * direction, - explosionPrefab.transform.rotation); + Instantiate(PrefabAtlas.BombExplosion, transform.position + i * direction, + PrefabAtlas.BombExplosion.transform.rotation); } else { @@ -79,7 +78,6 @@ namespace src.Ammo public void OnDestroy() { - DebugHelper.LogError("UNREGISTERED BOMB"); _bombsUtil.UnregisterBomb(transform.position); } } diff --git a/Assets/Scripts/src/Helpers/PrefabAtlas.cs b/Assets/Scripts/src/Helpers/PrefabAtlas.cs index e398034..9aa7a7c 100644 --- a/Assets/Scripts/src/Helpers/PrefabAtlas.cs +++ b/Assets/Scripts/src/Helpers/PrefabAtlas.cs @@ -18,17 +18,19 @@ namespace src.Helpers /* Upgrades */ public static readonly GameObject SpeedIncreaseUpgrade = - Resources.Load("Ammo/SpeedUpgrade"); + Resources.Load("Items/SpeedUpgrade"); public static readonly GameObject BombsIncreaseUpgrade = - Resources.Load("Ammo/BombUpgrade"); + Resources.Load("Items/BombUpgrade"); public static readonly GameObject FlamesIncreaseUpgrade = - Resources.Load("Ammo/FlameUpgrade"); + Resources.Load("Items/FlameUpgrade"); public static readonly GameObject GoldenBombUpgrade = - Resources.Load("GoldenBombUpgrade/FlameUpgrade"); + Resources.Load("Items/GoldenBombUpgrade"); /* Items */ public static readonly GameObject PlayerBomb = - Resources.Load("Ammo/Bomb"); + Resources.Load("Items/Bomb"); + public static readonly GameObject BombExplosion = + Resources.Load("Items/BombExplosion"); /* Enemies */ public static readonly GameObject GreenEnemy = Resources.Load("Enemies/SnowEnemyRandom");