diffusion #12

Merged
ktyl merged 6 commits from diffusion into main 2022-12-09 01:36:48 +01:00
2 changed files with 14 additions and 5 deletions
Showing only changes of commit 944ca8c3f2 - Show all commits

View File

@ -0,0 +1,8 @@
using Godot;
public struct Tile
{
public bool isHighlighted;
public float value;
public ShaderMaterial material;
}

View File

@ -12,11 +12,6 @@ public class WorldGrid : Node2D
[Export] [Export]
public int CellSize { get; set; } public int CellSize { get; set; }
private struct Tile
{
public bool isHighlighted;
public ShaderMaterial material;
}
private Tile[,] _tiles; private Tile[,] _tiles;
// Called when the node enters the scene tree for the first time. // Called when the node enters the scene tree for the first time.
@ -52,6 +47,11 @@ public class WorldGrid : Node2D
_tiles[x, y].isHighlighted ^= true; _tiles[x, y].isHighlighted ^= true;
} }
public void SetTileValue(int x, int y, float value)
{
_tiles[x, y].value = value;
}
public void GetGridPos(Vector2 position, out int x, out int y) public void GetGridPos(Vector2 position, out int x, out int y)
{ {
@ -84,6 +84,7 @@ public class WorldGrid : Node2D
{ {
var tile = new Tile(); var tile = new Tile();
tile.isHighlighted = false; tile.isHighlighted = false;
tile.value = 0.0f;
var node = TileScene.Instance<Node2D>(); var node = TileScene.Instance<Node2D>();
this.AddChild(node); this.AddChild(node);