mirror of
https://github.com/zoriya/Magical-Garden.git
synced 2026-06-05 09:59:21 +00:00
Adding tree power.
This commit is contained in:
@@ -38,7 +38,7 @@ RenderSettings:
|
||||
m_ReflectionIntensity: 1
|
||||
m_CustomReflection: {fileID: 0}
|
||||
m_Sun: {fileID: 0}
|
||||
m_IndirectSpecularColor: {r: 0.37311992, g: 0.38074034, b: 0.35872713, a: 1}
|
||||
m_IndirectSpecularColor: {r: 0.37311953, g: 0.38074014, b: 0.3587274, a: 1}
|
||||
m_UseRadianceAmbientProbe: 0
|
||||
--- !u!157 &3
|
||||
LightmapSettings:
|
||||
@@ -13478,7 +13478,7 @@ MonoBehaviour:
|
||||
- {fileID: 11400000, guid: 479a6c0ea55dd864aa07a48020a25d5d, type: 2}
|
||||
- {fileID: 0}
|
||||
canOverrideTree: 0
|
||||
canBePlacedOn: 2
|
||||
canBePlacedOn: 3
|
||||
count: 0
|
||||
- type: 0
|
||||
description:
|
||||
|
||||
@@ -103,13 +103,6 @@ public class InventoryManager : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
//Spawn Power
|
||||
switch (item.type)
|
||||
{
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
CallOtherPowers();
|
||||
}
|
||||
|
||||
@@ -128,16 +121,25 @@ public class InventoryManager : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
//Spawn Power
|
||||
switch (item.type)
|
||||
{
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
//CallOtherPowers();
|
||||
}
|
||||
|
||||
private void DeleteTreeAt(int index)
|
||||
{
|
||||
Vector2Int plotPos = GetPlotPositionByIndex(index);
|
||||
plots[index].treePlaced = TreeType.Nothing;
|
||||
|
||||
int i = 0;
|
||||
for (int y = 0; y > -4; y--)
|
||||
{
|
||||
for (int x = 0; x < 4; x++)
|
||||
{
|
||||
treeMap.SetTile(new Vector3Int(plotPos.x * 4 + x, plotPos.y * 4 + y, 0), null);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async void CallOtherPowers()
|
||||
{
|
||||
List<int> dontCallPlotPower = new List<int>();
|
||||
@@ -169,6 +171,28 @@ public class InventoryManager : MonoBehaviour
|
||||
await Task.Delay(1000);
|
||||
}
|
||||
}
|
||||
else if(plots[i].treePlaced == TreeType.ThirstyTree)
|
||||
{
|
||||
List<int> plot = new List<int>();
|
||||
|
||||
if (i - 1 >= 0 && i % 5 != 0 && plots[i - 1].treePlaced == TreeType.Cactus)
|
||||
plot.Add(i - 1);
|
||||
if (i + 1 <= 24 && i % 5 != 4 && plots[i + 1].treePlaced == TreeType.Cactus)
|
||||
plot.Add(i + 1);
|
||||
if (i - 5 >= 0 && plots[i - 5].treePlaced == TreeType.Cactus)
|
||||
plot.Add(i - 5);
|
||||
if (i + 5 <= 24 && plots[i + 5].treePlaced == TreeType.Cactus)
|
||||
plot.Add(i + 5);
|
||||
|
||||
if(plot.Count > 0)
|
||||
{
|
||||
int r = Random.Range(0, plot.Count);
|
||||
dontCallPlotPower.Add(plot[r]);
|
||||
DeleteTreeAt(i);
|
||||
PlaceTree(items[(int)TreeType.Cactus - 1], plot[r]);
|
||||
await Task.Delay(1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user