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

View file

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