From e771a6f9a18bef63e91f47ecb470fdbe23380e89 Mon Sep 17 00:00:00 2001 From: Anonymous Raccoon <32224410+AnonymusRaccoon@users.noreply.github.com> Date: Tue, 14 Aug 2018 00:08:47 +0200 Subject: [PATCH] Adding random tree at the begining --- Assets/Script/InventoryManager.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Assets/Script/InventoryManager.cs b/Assets/Script/InventoryManager.cs index d29bec1..685745e 100644 --- a/Assets/Script/InventoryManager.cs +++ b/Assets/Script/InventoryManager.cs @@ -153,13 +153,15 @@ public class InventoryManager : MonoBehaviour while(!CanPlantAt(index, tree)) { - print(index); index++; - if (index > plots.Length) - continue; + if (index == plots.Length) + break; } - PlaceTree(tree, index); + if (index != plots.Length) + PlaceTree(tree, index); + else + i--; } }