From 9c67083b79dd4d8ea9132afe5796f0aeb5535441 Mon Sep 17 00:00:00 2001 From: happy44300 Date: Mon, 13 Aug 2018 14:18:18 +0200 Subject: [PATCH] Revert "aq" This reverts commit d5ea81740d7232efc863f02a35c099334f31bc67. --- Assets/Script/InventoryManager.cs | 35 +++++++++++-------------------- 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/Assets/Script/InventoryManager.cs b/Assets/Script/InventoryManager.cs index 90dc093..39bafe0 100644 --- a/Assets/Script/InventoryManager.cs +++ b/Assets/Script/InventoryManager.cs @@ -45,7 +45,8 @@ public class InventoryManager : MonoBehaviour { if (items[draggedPosition].iconGris != null) { - GetComponent().sprite = items[draggedPosition].iconGris; + slots[draggedPosition].GetComponent().sprite = items[draggedPosition].iconGris; + Debug.Log("ici"); } else { @@ -66,7 +67,7 @@ public class InventoryManager : MonoBehaviour Vector3Int pos = treeMap.WorldToCell(position); if (-8 <= pos.x && pos.x <= 11 && -15 <= pos.y && pos.y <= 4) { - if (GetPlotIndex(pos) != -1 && (plots[GetPlotIndex(pos)].treePlaced == TreeType.Nothing || (plots[GetPlotIndex(pos)].treePlaced & item.canOverrideTree) != 0) && (plots[GetPlotIndex(pos)].type & item.canBePlacedOn) != 0) + if (GetPlotIndex(pos) != -1 && (plots[GetPlotIndex(pos)].treePlaced & item.canOverrideTree) != 0 && (plots[GetPlotIndex(pos)].type & item.canBePlacedOn) != 0) { return true; } @@ -81,18 +82,11 @@ public class InventoryManager : MonoBehaviour private bool CanPlantAt(int index, TreeItem item) { -<<<<<<< HEAD <<<<<<< HEAD if (index != -1 && (plots[index].treePlaced & item.canOverrideTree) != 0 && (plots[index].type & item.canBePlacedOn) != 0) ======= if (index != -1 && (plots[index].treePlaced == TreeType.Nothing || (plots[index].treePlaced & item.canOverrideTree) != 0) && (plots[index].type & item.canBePlacedOn) != 0) >>>>>>> 855b7e67b4d5af910de877aa8c5a694e22fdf088 -======= - print("Type: " + item.type); - print("Tree Type: " + (plots[index].treePlaced == TreeType.Nothing)); - print("Plot Type: " + ((plots[index].type & item.canBePlacedOn) != 0)); - if (index != -1 && (plots[index].treePlaced == TreeType.Nothing || (plots[index].treePlaced & item.canOverrideTree) != 0) && (plots[index].type & item.canBePlacedOn) != 0) ->>>>>>> parent of 04137b9... sq< { return true; } @@ -163,18 +157,16 @@ public class InventoryManager : MonoBehaviour { List freePlots = new List(); -<<<<<<< HEAD <<<<<<< HEAD if (CanPlantAt(i - 1, items[(int)TreeType.TribbleTree])) -======= - if (i - 1 >= 0 && i % 5 != 0 && CanPlantAt(i - 1, items[(int)TreeType.TribbleTree])) ->>>>>>> parent of 04137b9... sq< freePlots.Add(i - 1); - if (i + 1 <= 24 && i % 5 != 4 && CanPlantAt(i + 1, items[(int)TreeType.TribbleTree])) + if (CanPlantAt(i + 1, items[(int)TreeType.TribbleTree])) freePlots.Add(i + 1); - if (i - 5 >= 0 && CanPlantAt(i - 5, items[(int)TreeType.TribbleTree])) + + if (CanPlantAt(i - 6, items[(int)TreeType.TribbleTree])) + freePlots.Add(i - 6); + if (CanPlantAt(i - 5, items[(int)TreeType.TribbleTree])) freePlots.Add(i - 5); -<<<<<<< HEAD if (CanPlantAt(i - 4, items[(int)TreeType.TribbleTree])) freePlots.Add(i - 4); ======= @@ -191,12 +183,9 @@ public class InventoryManager : MonoBehaviour if (CanPlantAt(i + 6, items[(int)TreeType.TribbleTree])) freePlots.Add(i + 6); if (CanPlantAt(i + 5, items[(int)TreeType.TribbleTree])) -======= - if (i + 5 <= 24 && CanPlantAt(i + 5, items[(int)TreeType.TribbleTree])) ->>>>>>> parent of 04137b9... sq< freePlots.Add(i + 5); - - print(freePlots.Count); + if (CanPlantAt(i + 4, items[(int)TreeType.TribbleTree])) + freePlots.Add(i + 4); if(freePlots.Count > 0) { @@ -249,7 +238,7 @@ public class InventoryManager : MonoBehaviour i++; if ((i == 5 || i == 6 || i == 9 || i == 10) && canPlant) continue; - selectorMap.SetTile(new Vector3Int(plotPos.x * 4 + x, plotPos.y * 4 + y, 0), selector[i]); + treeMap.SetTile(new Vector3Int(plotPos.x * 4 + x, plotPos.y * 4 + y, 0), selector[i]); } } } @@ -261,7 +250,7 @@ public class InventoryManager : MonoBehaviour { for (int x = 0; x < 4; x++) { - selectorMap.SetTile(new Vector3Int(pos.x * 4 + x, pos.y * 4 + y, 0), null); + treeMap.SetTile(new Vector3Int(pos.x * 4 + x, pos.y * 4 + y, 0), null); i++; } }