rewilding #20
|
@ -1,13 +1,13 @@
|
|||
using Godot;
|
||||
|
||||
public class HeatSystem
|
||||
public class EnvironmentSystem
|
||||
{
|
||||
private readonly TileGrid _tiles;
|
||||
private readonly float _diffusionCoefficient;
|
||||
|
||||
private float[] _nextTemperatures = null;
|
||||
|
||||
public HeatSystem(TileGrid tiles, float diffusionCoefficient)
|
||||
public EnvironmentSystem(TileGrid tiles, float diffusionCoefficient)
|
||||
{
|
||||
_tiles = tiles;
|
||||
_diffusionCoefficient = diffusionCoefficient;
|
||||
|
@ -20,7 +20,6 @@ public class HeatSystem
|
|||
Diffuse();
|
||||
}
|
||||
|
||||
|
||||
private float TransferHeat(float t0, float alpha, float nx, float ny, float px, float py)
|
||||
{
|
||||
float d2tdx2 = nx - 2 * t0 + px;
|
||||
|
@ -96,5 +95,4 @@ public class HeatSystem
|
|||
_tiles[i] = tile;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -21,7 +21,7 @@ public class WorldGrid : Node2D
|
|||
public ShaderMaterial material;
|
||||
}
|
||||
private TileView[] _tileViews;
|
||||
private HeatSystem _heat;
|
||||
private EnvironmentSystem _environment;
|
||||
|
||||
// Called when the node enters the scene tree for the first time.
|
||||
public override void _Ready()
|
||||
|
@ -30,7 +30,7 @@ public class WorldGrid : Node2D
|
|||
|
||||
GenerateCanvasItems(_tileGrid);
|
||||
|
||||
_heat = new HeatSystem(_tileGrid, DiffusionCoefficient);
|
||||
_environment = new EnvironmentSystem(_tileGrid, DiffusionCoefficient);
|
||||
}
|
||||
|
||||
#region Positioning
|
||||
|
@ -101,5 +101,5 @@ public class WorldGrid : Node2D
|
|||
|
||||
public ShaderMaterial GetTileMaterial(int idx) => _tileViews[idx].material;
|
||||
|
||||
public void _on_Clock_OnTick(int ticks) => _heat.Process();
|
||||
public void _on_Clock_OnTick(int ticks) => _environment.Process();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue