27 lines
664 B
C#

using Godot;
public class NoOverlay : Overlay
{
[Export]
private Color _healthy;
[Export]
private Color _depleted;
// in this view we want to draw tiles with their normal colour
public override void Apply(Tile tile, ShaderMaterial material)
{
var type = tile.type;
if (type is Wild wild)
{
material.SetShaderParam("lowColor", _depleted);
material.SetShaderParam("highColor", _healthy);
material.SetShaderParam("t", tile.currentHealth);
return;
}
material.SetShaderParam("lowColor", type.Color);
material.SetShaderParam("t", 0);
}
}