summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatheus <matheus.guedes.mg.m@gmail.com>2025-08-28 17:21:38 -0300
committerMatheus <matheus.guedes.mg.m@gmail.com>2025-08-28 17:21:38 -0300
commite17510951f1136f4afeb2afbf76c47df151b299b (patch)
tree411f03c6e577380d4b84295c1796ce1aabe46813
parent358943907bc9e37d26618ee03adf1ffd97635335 (diff)
Mapa iluminado
-rw-r--r--assets/definitions/tiles/floor.tres2
-rw-r--r--assets/definitions/tiles/wall.tres3
-rw-r--r--scripts/map/Tile.cs6
-rw-r--r--scripts/map/TileDefinition.cs4
4 files changed, 13 insertions, 2 deletions
diff --git a/assets/definitions/tiles/floor.tres b/assets/definitions/tiles/floor.tres
index 7fa64ea..d06e101 100644
--- a/assets/definitions/tiles/floor.tres
+++ b/assets/definitions/tiles/floor.tres
@@ -6,6 +6,8 @@
[resource]
script = ExtResource("1_snxyj")
Texture = ExtResource("1_vvyfi")
+LitColor = Color(1, 1, 1, 1)
+DarkColor = Color(0.272655, 0.272655, 0.272655, 1)
IsWalkable = true
IsTransparent = true
metadata/_custom_type_script = "uid://ba82a33ov6uuo"
diff --git a/assets/definitions/tiles/wall.tres b/assets/definitions/tiles/wall.tres
index bc16528..c4d67f7 100644
--- a/assets/definitions/tiles/wall.tres
+++ b/assets/definitions/tiles/wall.tres
@@ -6,5 +6,8 @@
[resource]
script = ExtResource("1_ugwtv")
Texture = ExtResource("1_jkwov")
+LitColor = Color(1, 1, 1, 1)
+DarkColor = Color(0.152476, 0.152476, 0.152476, 1)
IsWalkable = false
+IsTransparent = false
metadata/_custom_type_script = "uid://ba82a33ov6uuo"
diff --git a/scripts/map/Tile.cs b/scripts/map/Tile.cs
index 67b9be5..39f7486 100644
--- a/scripts/map/Tile.cs
+++ b/scripts/map/Tile.cs
@@ -44,9 +44,10 @@ public partial class Tile : Sprite2D
/// Elementos neste tile estão dentro do campo de visão do jogador.
/// </summary>
public bool IsInView {
- get => this.isInView;
+ get => isInView;
set {
- this.isInView = value;
+ isInView = value;
+ Modulate = isInView ? definition.LitColor : definition.DarkColor;
if (IsInView && !IsExplored) {
IsExplored = true;
}
@@ -72,6 +73,7 @@ public partial class Tile : Sprite2D
/// <param name="definition">Definição do tile.</param>
public void SetDefinition(TileDefinition definition) {
this.definition = definition;
+ Modulate = definition.DarkColor;
Texture = definition.Texture;
IsWalkable = definition.IsWalkable;
IsTransparent = definition.IsTransparent;
diff --git a/scripts/map/TileDefinition.cs b/scripts/map/TileDefinition.cs
index 235508a..84e5cc1 100644
--- a/scripts/map/TileDefinition.cs
+++ b/scripts/map/TileDefinition.cs
@@ -9,6 +9,10 @@ public partial class TileDefinition : Resource
[ExportCategory("Visuals")]
[Export]
public Texture2D Texture { get; set; }
+ [Export(PropertyHint.ColorNoAlpha)]
+ public Color LitColor { get; set; } = Colors.White;
+ [Export(PropertyHint.ColorNoAlpha)]
+ public Color DarkColor { get; set; } = Colors.White;
[ExportCategory("Mechanics")]
[Export]