22 lines
472 B
C#
22 lines
472 B
C#
using Unity.Collections;
|
|
using Unity.Mathematics;
|
|
|
|
namespace DanieleMarotta.RiversongCodeShowcase
|
|
{
|
|
public class WaterMap : NativeGrid<int>
|
|
{
|
|
public WaterMap(int2 size) : base(size, Allocator.Persistent)
|
|
{
|
|
}
|
|
|
|
public bool IsWater(int2 tile)
|
|
{
|
|
return GetValue(tile) == 0;
|
|
}
|
|
|
|
public bool IsNearWater(int2 tile)
|
|
{
|
|
return GetValue(tile) is > 0 and < int.MaxValue;
|
|
}
|
|
}
|
|
} |