diff --git a/Assets/Script/InventoryManager.cs b/Assets/Script/InventoryManager.cs index 685745e..a6204e2 100644 --- a/Assets/Script/InventoryManager.cs +++ b/Assets/Script/InventoryManager.cs @@ -124,6 +124,8 @@ public class InventoryManager : MonoBehaviour } } + plots[index].startIndex = index; + CallPowers(index); } @@ -338,6 +340,53 @@ public class InventoryManager : MonoBehaviour await Task.Delay(1000); } } + else if (plots[i].treePlaced == TreeType.RoundabboutTree) + { + if(plots[i].startIndex == i) + { + if (i - 1 >= 0 && i % 5 != 0 && i + 5 <= 24) + { + TreeType firstType = plots[i - 1].treePlaced; + TreeType secondType = plots[i + 4].treePlaced; + TreeType thirdType = plots[i + 5].treePlaced; + PlaceTree(items[(int)TreeType.RoundabboutTree], i - 1); + PlaceTree(items[(int)firstType], i + 4); + PlaceTree(items[(int)secondType], i + 5); + PlaceTree(items[(int)thirdType], i ); + } + } + else if (plots[i].startIndex == i + 1) + { + TreeType firstType = plots[i + 5].treePlaced; + TreeType secondType = plots[i + 6].treePlaced; + TreeType thirdType = plots[i + 1].treePlaced; + PlaceTree(items[(int)TreeType.RoundabboutTree], i + 5); + PlaceTree(items[(int)firstType], i + 6); + PlaceTree(items[(int)secondType], i + 1); + PlaceTree(items[(int)thirdType], i); + } + else if (plots[i].startIndex == i + 4) + { + TreeType firstType = plots[i + 1].treePlaced; + TreeType secondType = plots[i - 4].treePlaced; + TreeType thirdType = plots[i - 5].treePlaced; + PlaceTree(items[(int)TreeType.RoundabboutTree], i + 1); + PlaceTree(items[(int)firstType], i - 4); + PlaceTree(items[(int)secondType], i - 5); + PlaceTree(items[(int)thirdType], i); + } + else if (plots[i].startIndex == i + 5) + { + TreeType firstType = plots[i - 5].treePlaced; + TreeType secondType = plots[i - 4].treePlaced; + TreeType thirdType = plots[i - 1].treePlaced; + PlaceTree(items[(int)TreeType.RoundabboutTree], i - 5); + PlaceTree(items[(int)firstType], i - 4); + PlaceTree(items[(int)secondType], i - 1); + PlaceTree(items[(int)thirdType], i); + } + + } } if (UserHasWon()) diff --git a/Assets/Script/Plot.cs b/Assets/Script/Plot.cs index b77dde4..af16895 100644 --- a/Assets/Script/Plot.cs +++ b/Assets/Script/Plot.cs @@ -4,6 +4,8 @@ public class Plot [EnumFlags] public PlotType type; public TreeType treePlaced; + + public int startIndex; } [System.Flags] diff --git a/Assets/Script/TreeItem.cs b/Assets/Script/TreeItem.cs index cf7b1f5..cc564d6 100644 --- a/Assets/Script/TreeItem.cs +++ b/Assets/Script/TreeItem.cs @@ -19,7 +19,7 @@ public enum TreeType { Nothing, AppleTree, - Unamed0, + RoundabboutTree, TribbleTree, Unamed1, SwapTree,