riversong code showcase
This commit is contained in:
22
Source/Riversong/Game/World/WaterMap.cs
Normal file
22
Source/Riversong/Game/World/WaterMap.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user