Renamed Resources/Ammo to Resources/Items and Explosion to BombExplosion

This commit is contained in:
Denis-Cosmin Nutiu 2019-08-24 19:19:44 +03:00
parent d6ffb9b095
commit 13ab2ddb9c
15 changed files with 17 additions and 17 deletions

View file

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: bf3e6294c377ca84d82651fe870a56dc guid: 142c20937b0ba4d1b9a77c8504dda487
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}

View file

@ -8,25 +8,24 @@ namespace src.Ammo
{ {
public class BombController : GameplayComponent, IExplosable public class BombController : GameplayComponent, IExplosable
{ {
public GameObject explosionPrefab;
private BombCameraShake _cameraShake;
private readonly BombsUtilManager _bombsUtil = BombsUtilManager.instance; private readonly BombsUtilManager _bombsUtil = BombsUtilManager.instance;
private BombCameraShake _cameraShake;
private SpriteRenderer _spriteRenderer;
private bool _exploded; private bool _exploded;
// Start is called before the first frame update // Start is called before the first frame update
void Start() private void Start()
{ {
_cameraShake = GameObject.Find("VCAM1").GetComponent<BombCameraShake>(); _cameraShake = GameObject.Find("VCAM1").GetComponent<BombCameraShake>();
_spriteRenderer = GetComponentInChildren<SpriteRenderer>();
Invoke(nameof(Explode), _bombsUtil.timer); Invoke(nameof(Explode), _bombsUtil.timer);
} }
void Explode() private void Explode()
{ {
Instantiate(explosionPrefab, transform.position, Quaternion.identity); Instantiate(PrefabAtlas.BombExplosion, transform.position, Quaternion.identity);
GetComponentInChildren<SpriteRenderer>().enabled = false;
_spriteRenderer.enabled = false;
_cameraShake.StartCameraShakeCoro(); _cameraShake.StartCameraShakeCoro();
StartCoroutine(CreateExplosions(Vector3.down)); StartCoroutine(CreateExplosions(Vector3.down));
StartCoroutine(CreateExplosions(Vector3.left)); StartCoroutine(CreateExplosions(Vector3.left));
@ -49,8 +48,8 @@ namespace src.Ammo
if (!hit.collider) if (!hit.collider)
{ {
Instantiate(explosionPrefab, transform.position + i * direction, Instantiate(PrefabAtlas.BombExplosion, transform.position + i * direction,
explosionPrefab.transform.rotation); PrefabAtlas.BombExplosion.transform.rotation);
} }
else else
{ {
@ -79,7 +78,6 @@ namespace src.Ammo
public void OnDestroy() public void OnDestroy()
{ {
DebugHelper.LogError("UNREGISTERED BOMB");
_bombsUtil.UnregisterBomb(transform.position); _bombsUtil.UnregisterBomb(transform.position);
} }
} }

View file

@ -18,17 +18,19 @@ namespace src.Helpers
/* Upgrades */ /* Upgrades */
public static readonly GameObject SpeedIncreaseUpgrade = public static readonly GameObject SpeedIncreaseUpgrade =
Resources.Load<GameObject>("Ammo/SpeedUpgrade"); Resources.Load<GameObject>("Items/SpeedUpgrade");
public static readonly GameObject BombsIncreaseUpgrade = public static readonly GameObject BombsIncreaseUpgrade =
Resources.Load<GameObject>("Ammo/BombUpgrade"); Resources.Load<GameObject>("Items/BombUpgrade");
public static readonly GameObject FlamesIncreaseUpgrade = public static readonly GameObject FlamesIncreaseUpgrade =
Resources.Load<GameObject>("Ammo/FlameUpgrade"); Resources.Load<GameObject>("Items/FlameUpgrade");
public static readonly GameObject GoldenBombUpgrade = public static readonly GameObject GoldenBombUpgrade =
Resources.Load<GameObject>("GoldenBombUpgrade/FlameUpgrade"); Resources.Load<GameObject>("Items/GoldenBombUpgrade");
/* Items */ /* Items */
public static readonly GameObject PlayerBomb = public static readonly GameObject PlayerBomb =
Resources.Load<GameObject>("Ammo/Bomb"); Resources.Load<GameObject>("Items/Bomb");
public static readonly GameObject BombExplosion =
Resources.Load<GameObject>("Items/BombExplosion");
/* Enemies */ /* Enemies */
public static readonly GameObject GreenEnemy = Resources.Load<GameObject>("Enemies/SnowEnemyRandom"); public static readonly GameObject GreenEnemy = Resources.Load<GameObject>("Enemies/SnowEnemyRandom");