heat #16

Merged
ktyl merged 7 commits from heat into main 2022-12-13 01:54:54 +01:00
8 changed files with 10 additions and 29 deletions
Showing only changes of commit 86b8739982 - Show all commits

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=12 format=2] [gd_scene load_steps=11 format=2]
[ext_resource path="res://nodes/grid.tscn" type="PackedScene" id=1] [ext_resource path="res://nodes/grid.tscn" type="PackedScene" id=1]
[ext_resource path="res://nodes/grid_cursor.tscn" type="PackedScene" id=2] [ext_resource path="res://nodes/grid_cursor.tscn" type="PackedScene" id=2]
@ -7,7 +7,6 @@
[ext_resource path="res://nodes/interaction_modes/interaction_mode.tscn" type="PackedScene" id=5] [ext_resource path="res://nodes/interaction_modes/interaction_mode.tscn" type="PackedScene" id=5]
[ext_resource path="res://nodes/ui/build_mode_ui.tscn" type="PackedScene" id=6] [ext_resource path="res://nodes/ui/build_mode_ui.tscn" type="PackedScene" id=6]
[ext_resource path="res://nodes/interaction_modes/build_mode.tscn" type="PackedScene" id=7] [ext_resource path="res://nodes/interaction_modes/build_mode.tscn" type="PackedScene" id=7]
[ext_resource path="res://resources/tiles/tiles.tres" type="Resource" id=8]
[ext_resource path="res://nodes/ui/mode_selection_ui.tscn" type="PackedScene" id=9] [ext_resource path="res://nodes/ui/mode_selection_ui.tscn" type="PackedScene" id=9]
[ext_resource path="res://nodes/overlays.tscn" type="PackedScene" id=10] [ext_resource path="res://nodes/overlays.tscn" type="PackedScene" id=10]
@ -21,7 +20,6 @@ _autoTick = true
[node name="World Grid" parent="." instance=ExtResource( 1 )] [node name="World Grid" parent="." instance=ExtResource( 1 )]
DiffusionCoefficient = 0.1 DiffusionCoefficient = 0.1
_tileGridResource = ExtResource( 8 )
[node name="Cursor" parent="." instance=ExtResource( 2 )] [node name="Cursor" parent="." instance=ExtResource( 2 )]
Grid = NodePath("../World Grid") Grid = NodePath("../World Grid")

View File

@ -1,10 +1,11 @@
[gd_scene load_steps=3 format=2] [gd_scene load_steps=4 format=2]
[ext_resource path="res://scripts/WorldGrid.cs" type="Script" id=1] [ext_resource path="res://scripts/WorldGrid.cs" type="Script" id=1]
[ext_resource path="res://nodes/tile.tscn" type="PackedScene" id=2] [ext_resource path="res://nodes/tile.tscn" type="PackedScene" id=2]
[ext_resource path="res://resources/tiles/tiles.tres" type="Resource" id=3]
[node name="Grid" type="Node2D"] [node name="Grid" type="Node2D"]
script = ExtResource( 1 ) script = ExtResource( 1 )
TileScene = ExtResource( 2 ) TileScene = ExtResource( 2 )
Size = 10
CellSize = 64 CellSize = 64
_tileGridResource = ExtResource( 3 )

View File

@ -8,4 +8,4 @@ Name = "Developed"
BuildLabel = "[D]eveloped" BuildLabel = "[D]eveloped"
Key = 68 Key = 68
Color = Color( 0.372549, 0.372549, 0.372549, 1 ) Color = Color( 0.372549, 0.372549, 0.372549, 1 )
HeatGeneration = 0.1 HeatGeneration = 0.4

View File

@ -8,4 +8,4 @@ Name = "Wild"
BuildLabel = "[W]ild" BuildLabel = "[W]ild"
Key = 87 Key = 87
Color = Color( 0, 0.545098, 0.0196078, 1 ) Color = Color( 0, 0.545098, 0.0196078, 1 )
HeatGeneration = -0.025 HeatGeneration = -0.2

View File

@ -9,14 +9,10 @@ public class HeatOverlay : Overlay
[Export] [Export]
private Color _hotColor; private Color _hotColor;
public override void Initialise(Tile tile, ShaderMaterial material) public override void Apply(Tile tile, ShaderMaterial material)
{ {
material.SetShaderParam("lowColor", _coldColor); material.SetShaderParam("lowColor", _coldColor);
material.SetShaderParam("highColor", _hotColor); material.SetShaderParam("highColor", _hotColor);
}
public override void Process(Tile tile, ShaderMaterial material)
{
material.SetShaderParam("t", tile.temperature); material.SetShaderParam("t", tile.temperature);
} }
} }

View File

@ -3,15 +3,10 @@ using Godot;
public class NoOverlay : Overlay public class NoOverlay : Overlay
{ {
// in this view we want to draw tiles with their normal colour // in this view we want to draw tiles with their normal colour
public override void Apply(Tile tile, ShaderMaterial material)
public override void Initialise(Tile tile, ShaderMaterial material)
{ {
var type = tile.type; var type = tile.type;
material.SetShaderParam("lowColor", type.Color); material.SetShaderParam("lowColor", type.Color);
material.SetShaderParam("t", 0); material.SetShaderParam("t", 0);
} }
public override void Process(Tile tile, ShaderMaterial material)
{
}
} }

View File

@ -2,6 +2,5 @@ using Godot;
public abstract class Overlay : Resource public abstract class Overlay : Resource
{ {
public abstract void Initialise(Tile tile, ShaderMaterial material); public abstract void Apply(Tile tile, ShaderMaterial material);
public abstract void Process(Tile tile, ShaderMaterial material);
} }

View File

@ -56,7 +56,7 @@ public class Overlays : Node
var tile = _tileGrid[i]; var tile = _tileGrid[i];
var material = _worldGrid.GetTileMaterial(i); var material = _worldGrid.GetTileMaterial(i);
Current.Process(tile, material); Current.Apply(tile, material);
} }
} }
@ -64,13 +64,5 @@ public class Overlays : Node
{ {
_overlayIdx++; _overlayIdx++;
_overlayIdx %= _overlays.Length; _overlayIdx %= _overlays.Length;
for (int i = 0; i < _tileGrid.Count; i++)
{
var tile = _tileGrid[i];
var material = _worldGrid.GetTileMaterial(i);
Current.Initialise(tile, material);
}
} }
} }