62 lines
1.4 KiB
C#
62 lines
1.4 KiB
C#
using UnityEngine;
|
|
|
|
namespace FloodSWE.TileGraph
|
|
{
|
|
public sealed class TileNode
|
|
{
|
|
public TileId Id;
|
|
public float TileSizeMeters;
|
|
public int GridRes;
|
|
|
|
public Texture TerrainHeight;
|
|
public Texture Porosity;
|
|
|
|
public RenderTexture WaterA;
|
|
public RenderTexture WaterB;
|
|
public RenderTexture VelA;
|
|
public RenderTexture VelB;
|
|
|
|
public bool Active;
|
|
public float Priority;
|
|
public float MaxDepth;
|
|
public float MaxSpeed;
|
|
|
|
public TileNode Parent;
|
|
public TileNode[] Children;
|
|
|
|
public TileNode(TileId id, float tileSizeMeters, int gridRes)
|
|
{
|
|
Id = id;
|
|
TileSizeMeters = tileSizeMeters;
|
|
GridRes = gridRes;
|
|
}
|
|
|
|
public bool HasChildren
|
|
{
|
|
get { return Children != null && Children.Length == 4; }
|
|
}
|
|
|
|
public bool HasActiveChildren
|
|
{
|
|
get
|
|
{
|
|
if (!HasChildren)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
for (int i = 0; i < Children.Length; i++)
|
|
{
|
|
TileNode child = Children[i];
|
|
if (child != null && child.Active)
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
}
|