From 4100f25567d29f4d070a801ca0f9d274ec26d871 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Nu=C8=9Biu?= Date: Wed, 5 Jun 2019 22:24:19 +0300 Subject: [PATCH] Add additional logging on exit & update spawn --- Assets/Scripts/src/Managers/LevelManager.cs | 6 +++++- Assets/Scripts/src/Wall/DestructibleWall.cs | 8 ++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Assets/Scripts/src/Managers/LevelManager.cs b/Assets/Scripts/src/Managers/LevelManager.cs index 082d64d..211d64b 100644 --- a/Assets/Scripts/src/Managers/LevelManager.cs +++ b/Assets/Scripts/src/Managers/LevelManager.cs @@ -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(); + 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(); + 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); diff --git a/Assets/Scripts/src/Wall/DestructibleWall.cs b/Assets/Scripts/src/Wall/DestructibleWall.cs index 33bc1c4..733801e 100644 --- a/Assets/Scripts/src/Wall/DestructibleWall.cs +++ b/Assets/Scripts/src/Wall/DestructibleWall.cs @@ -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