mirror of
https://github.com/zoriya/Magical-Garden.git
synced 2026-06-05 09:59:21 +00:00
Merge branch 'master' of https://github.com/AnonymusRaccoon/New-Unity-Project
This commit is contained in:
@@ -81,6 +81,9 @@ public class InventoryManager : MonoBehaviour
|
||||
|
||||
private bool CanPlantAt(int index, TreeItem item)
|
||||
{
|
||||
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)
|
||||
{
|
||||
return true;
|
||||
@@ -152,13 +155,13 @@ public class InventoryManager : MonoBehaviour
|
||||
{
|
||||
List<int> freePlots = new List<int>();
|
||||
|
||||
if (i - 1 >= 0 && i % 5 != 0 && CanPlantAt(i - 1, items[(int)TreeType.TribbleTree - 1]))
|
||||
if (i - 1 >= 0 && i % 5 != 0 && CanPlantAt(i - 1, items[(int)TreeType.TribbleTree]))
|
||||
freePlots.Add(i - 1);
|
||||
if (i + 1 <= 24 && i % 5 != 4 && CanPlantAt(i + 1, items[(int)TreeType.TribbleTree - 1]))
|
||||
if (i + 1 <= 24 && i % 5 != 4 && CanPlantAt(i + 1, items[(int)TreeType.TribbleTree]))
|
||||
freePlots.Add(i + 1);
|
||||
if (i - 5 >= 0 && CanPlantAt(i - 5, items[(int)TreeType.TribbleTree - 1]))
|
||||
if (i - 5 >= 0 && CanPlantAt(i - 5, items[(int)TreeType.TribbleTree]))
|
||||
freePlots.Add(i - 5);
|
||||
if (i + 5 <= 24 && CanPlantAt(i + 5, items[(int)TreeType.TribbleTree - 1]))
|
||||
if (i + 5 <= 24 && CanPlantAt(i + 5, items[(int)TreeType.TribbleTree]))
|
||||
freePlots.Add(i + 5);
|
||||
|
||||
print(freePlots.Count);
|
||||
|
||||
Reference in New Issue
Block a user