Add additional logging on exit & update spawn

This commit is contained in:
Denis-Cosmin Nutiu 2019-06-05 22:24:19 +03:00
parent 9533269c96
commit 4100f25567
2 changed files with 11 additions and 3 deletions

View file

@ -76,9 +76,10 @@ namespace src.Managers
Debug.LogWarning("No destructible walls left, cannot spawn upgrade."); Debug.LogWarning("No destructible walls left, cannot spawn upgrade.");
continue; continue;
} }
/* Get the destructible wall script and make it to spawn the upgrade */ /* Get the destructible wall script and make it to spawn the upgrade */
var wall = _destructibleWalls.PopRandom().GetComponent<DestructibleWall>(); var wall = _destructibleWalls.PopRandom().GetComponent<DestructibleWall>();
Debug.Log($"Spawned upgrade at: x:{wall.XCoordinate} y:{wall.YCoordinate}");
wall.SpawnsUpgrade(); wall.SpawnsUpgrade();
} }
} }
@ -90,8 +91,10 @@ namespace src.Managers
Debug.LogWarning("No destructible walls found, cannot spawn exit!"); Debug.LogWarning("No destructible walls found, cannot spawn exit!");
return; return;
} }
/* Get the destructible wall script and make it to spawn the exit */ /* Get the destructible wall script and make it to spawn the exit */
var wall = _destructibleWalls.PopRandom().GetComponent<DestructibleWall>(); var wall = _destructibleWalls.PopRandom().GetComponent<DestructibleWall>();
Debug.Log($"Spawned exit at: x:{wall.XCoordinate} y:{wall.YCoordinate}");
wall.SpawnsExit(); wall.SpawnsExit();
} }
@ -156,6 +159,7 @@ namespace src.Managers
private void PlaceDestructibleTile(Vector3 position) private void PlaceDestructibleTile(Vector3 position)
{ {
Debug.Log($"PlaceDestructibleTile: x:{position.x} y:{position.y}");
var instance = Instantiate(destructibleWallPrefab, position, Quaternion.identity); var instance = Instantiate(destructibleWallPrefab, position, Quaternion.identity);
_destructibleWalls.Add(instance); _destructibleWalls.Add(instance);
instance.transform.SetParent(boardHolder); instance.transform.SetParent(boardHolder);

View file

@ -16,13 +16,17 @@ namespace src.Wall
{ {
_spawnUpgrade = true; _spawnUpgrade = true;
} }
public float XCoordinate => transform.position.x;
public float YCoordinate => transform.position.y;
public void OnDestroy() public void OnDestroy()
{ {
if (_spawnExit) if (_spawnExit)
{ {
// TODO Spawn an exit // TODO Spawn an exit
} else if (_spawnUpgrade) }
else if (_spawnUpgrade)
{ {
// TODO Spawn an upgrade, use composition to UpgradeManager // TODO Spawn an upgrade, use composition to UpgradeManager
// to get random / desired upgrade // to get random / desired upgrade