mirror of
https://github.com/zoriya/Magical-Garden.git
synced 2026-06-07 02:32:12 +00:00
@@ -45,7 +45,8 @@ public class InventoryManager : MonoBehaviour
|
||||
{
|
||||
if (items[draggedPosition].iconGris != null)
|
||||
{
|
||||
GetComponent<SpriteRenderer>().sprite = items[draggedPosition].iconGris;
|
||||
slots[draggedPosition].GetComponent<SpriteRenderer>().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<int> freePlots = new List<int>();
|
||||
|
||||
<<<<<<< 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++;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user