diff --git a/game_manager.tscn b/game_manager.tscn index ace8e40..d9a555b 100644 --- a/game_manager.tscn +++ b/game_manager.tscn @@ -4,3 +4,7 @@ [node name="GameManager" type="Node"] script = ExtResource("1_uwl7p") + +[node name="OneSecondTicker" type="Timer" parent="."] +unique_name_in_owner = true +autostart = true diff --git a/project.godot b/project.godot index 609a436..0ff3726 100644 --- a/project.godot +++ b/project.godot @@ -17,9 +17,10 @@ config/icon="res://icon.svg" [autoload] -Dialogic="*res://addons/dialogic/Core/DialogicGameHandler.gd" +GameManager="*res://game_manager.tscn" +OneSecondTicker="*res://game_manager.tscn" PlayerInfo="*res://scripts/PlayerInfo.cs" -GameManager="*res://scripts/GameManager.cs" +Dialogic="*res://addons/dialogic/Core/DialogicGameHandler.gd" [dialogic] diff --git a/scripts/GameManager.cs b/scripts/GameManager.cs index debdf20..1bf1b3a 100644 --- a/scripts/GameManager.cs +++ b/scripts/GameManager.cs @@ -6,7 +6,7 @@ public partial class GameManager : Node /// /// Indicates if the game is currently in tutorial mode. /// - public static bool IsTutorial { get; set; } + public static bool IsTutorial { get; private set; } // Called when the node enters the scene tree for the first time. public override void _Ready() { diff --git a/scripts/PlayerInfo.cs b/scripts/PlayerInfo.cs index 7ebc40d..5360051 100644 --- a/scripts/PlayerInfo.cs +++ b/scripts/PlayerInfo.cs @@ -58,10 +58,18 @@ public partial class PlayerInfo : Node // Called when the node enters the scene tree for the first time. public override void _Ready() { + var ticker = GetNode("/root/GameManager/OneSecondTicker"); + ticker.Timeout += OnTickerTimeout; } // Called every frame. 'delta' is the elapsed time since the previous frame. public override void _Process(double delta) { } + + private static void OnTickerTimeout() + { + Date = DateOnly.FromDateTime(DateTime.Now); + GD.Print(Date.ToString()); + } } diff --git a/scripts/TestMap.cs b/scripts/TestMap.cs index a7a195f..a25d35b 100644 --- a/scripts/TestMap.cs +++ b/scripts/TestMap.cs @@ -12,10 +12,14 @@ public partial class TestMap : TileMapLayer // Called when the node enters the scene tree for the first time. public override void _Ready() { + // Initialize the lastHighlightCell to an invalid value. lastHighlightCell = vector2INegOne; } - // Called every frame. 'delta' is the elapsed time since the previous frame. + /// + /// Called every frame. + /// + /// the elapsed time since the previous frame. public override void _Process(double delta) { Vector2 mousePos = GetLocalMousePosition();