Add Timer
This commit is contained in:
parent
41654c78c7
commit
a58ad6c62f
@ -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
|
||||
|
||||
@ -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]
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ public partial class GameManager : Node
|
||||
/// <summary>
|
||||
/// Indicates if the game is currently in tutorial mode.
|
||||
/// </summary>
|
||||
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()
|
||||
{
|
||||
|
||||
@ -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<Timer>("/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());
|
||||
}
|
||||
}
|
||||
|
||||
@ -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.
|
||||
/// <summary>
|
||||
/// Called every frame.
|
||||
/// </summary>
|
||||
/// <param name="delta">the elapsed time since the previous frame.</param>
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
Vector2 mousePos = GetLocalMousePosition();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user