summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--assets/sprites/character.pngbin0 -> 277 bytes
-rw-r--r--assets/sprites/character.png.import34
-rw-r--r--assets/sprites/skeleton.pngbin0 -> 215 bytes
-rw-r--r--assets/sprites/skeleton.png.import34
-rw-r--r--assets/sprites/skeleton.pxobin0 -> 838 bytes
-rw-r--r--assets/sprites/tilemap.pngbin0 -> 397 bytes
-rw-r--r--assets/sprites/tilemap.png.import34
-rw-r--r--assets/test_tileset.tres14
-rw-r--r--project.godot35
-rw-r--r--projeto-fantasia.csproj7
-rw-r--r--projeto-fantasia.sln19
-rw-r--r--scenes/character.tscn12
-rw-r--r--scenes/skeleton.tscn8
-rw-r--r--scenes/test_map.tscn29
-rw-r--r--scenes/turn_manager.tscn6
-rw-r--r--scripts/Actor.cs35
-rw-r--r--scripts/Actor.cs.uid1
-rw-r--r--scripts/Character.cs51
-rw-r--r--scripts/Character.cs.uid1
-rw-r--r--scripts/DungeonLevel.cs18
-rw-r--r--scripts/DungeonLevel.cs.uid1
-rw-r--r--scripts/Enemy.cs10
-rw-r--r--scripts/Enemy.cs.uid1
-rw-r--r--scripts/TurnManager.cs61
-rw-r--r--scripts/TurnManager.cs.uid1
25 files changed, 411 insertions, 1 deletions
diff --git a/assets/sprites/character.png b/assets/sprites/character.png
new file mode 100644
index 0000000..184119a
--- /dev/null
+++ b/assets/sprites/character.png
Binary files differ
diff --git a/assets/sprites/character.png.import b/assets/sprites/character.png.import
new file mode 100644
index 0000000..81e46a6
--- /dev/null
+++ b/assets/sprites/character.png.import
@@ -0,0 +1,34 @@
+[remap]
+
+importer="texture"
+type="CompressedTexture2D"
+uid="uid://dwky8qc2y602k"
+path="res://.godot/imported/character.png-529a34c9bb84961fe0878b6df0db59b4.ctex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://assets/sprites/character.png"
+dest_files=["res://.godot/imported/character.png-529a34c9bb84961fe0878b6df0db59b4.ctex"]
+
+[params]
+
+compress/mode=0
+compress/high_quality=false
+compress/lossy_quality=0.7
+compress/hdr_compression=1
+compress/normal_map=0
+compress/channel_pack=0
+mipmaps/generate=false
+mipmaps/limit=-1
+roughness/mode=0
+roughness/src_normal=""
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/normal_map_invert_y=false
+process/hdr_as_srgb=false
+process/hdr_clamp_exposure=false
+process/size_limit=0
+detect_3d/compress_to=1
diff --git a/assets/sprites/skeleton.png b/assets/sprites/skeleton.png
new file mode 100644
index 0000000..224afc6
--- /dev/null
+++ b/assets/sprites/skeleton.png
Binary files differ
diff --git a/assets/sprites/skeleton.png.import b/assets/sprites/skeleton.png.import
new file mode 100644
index 0000000..4b41cb3
--- /dev/null
+++ b/assets/sprites/skeleton.png.import
@@ -0,0 +1,34 @@
+[remap]
+
+importer="texture"
+type="CompressedTexture2D"
+uid="uid://dh5sgjdwkps88"
+path="res://.godot/imported/skeleton.png-3c82138048422abf990547c960b9a428.ctex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://assets/sprites/skeleton.png"
+dest_files=["res://.godot/imported/skeleton.png-3c82138048422abf990547c960b9a428.ctex"]
+
+[params]
+
+compress/mode=0
+compress/high_quality=false
+compress/lossy_quality=0.7
+compress/hdr_compression=1
+compress/normal_map=0
+compress/channel_pack=0
+mipmaps/generate=false
+mipmaps/limit=-1
+roughness/mode=0
+roughness/src_normal=""
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/normal_map_invert_y=false
+process/hdr_as_srgb=false
+process/hdr_clamp_exposure=false
+process/size_limit=0
+detect_3d/compress_to=1
diff --git a/assets/sprites/skeleton.pxo b/assets/sprites/skeleton.pxo
new file mode 100644
index 0000000..d2cfbf3
--- /dev/null
+++ b/assets/sprites/skeleton.pxo
Binary files differ
diff --git a/assets/sprites/tilemap.png b/assets/sprites/tilemap.png
new file mode 100644
index 0000000..dece7ed
--- /dev/null
+++ b/assets/sprites/tilemap.png
Binary files differ
diff --git a/assets/sprites/tilemap.png.import b/assets/sprites/tilemap.png.import
new file mode 100644
index 0000000..639070f
--- /dev/null
+++ b/assets/sprites/tilemap.png.import
@@ -0,0 +1,34 @@
+[remap]
+
+importer="texture"
+type="CompressedTexture2D"
+uid="uid://8lincth7scjr"
+path="res://.godot/imported/tilemap.png-97bf26cbe4098c4ccdc8ca24f9406864.ctex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://assets/sprites/tilemap.png"
+dest_files=["res://.godot/imported/tilemap.png-97bf26cbe4098c4ccdc8ca24f9406864.ctex"]
+
+[params]
+
+compress/mode=0
+compress/high_quality=false
+compress/lossy_quality=0.7
+compress/hdr_compression=1
+compress/normal_map=0
+compress/channel_pack=0
+mipmaps/generate=false
+mipmaps/limit=-1
+roughness/mode=0
+roughness/src_normal=""
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/normal_map_invert_y=false
+process/hdr_as_srgb=false
+process/hdr_clamp_exposure=false
+process/size_limit=0
+detect_3d/compress_to=1
diff --git a/assets/test_tileset.tres b/assets/test_tileset.tres
new file mode 100644
index 0000000..0c582c4
--- /dev/null
+++ b/assets/test_tileset.tres
@@ -0,0 +1,14 @@
+[gd_resource type="TileSet" load_steps=3 format=3 uid="uid://biilh0ufacguh"]
+
+[ext_resource type="Texture2D" uid="uid://8lincth7scjr" path="res://assets/sprites/tilemap.png" id="1_sdj6w"]
+
+[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_siwt3"]
+texture = ExtResource("1_sdj6w")
+0:0/0 = 0
+0:0/0/custom_data_0 = true
+1:0/0 = 0
+
+[resource]
+custom_data_layer_0/name = "isWalkable"
+custom_data_layer_0/type = 1
+sources/0 = SubResource("TileSetAtlasSource_siwt3")
diff --git a/project.godot b/project.godot
index 154fdf2..0e7d507 100644
--- a/project.godot
+++ b/project.godot
@@ -11,9 +11,42 @@ config_version=5
[application]
config/name="projeto-fantasia"
-config/features=PackedStringArray("4.4", "Forward Plus")
+run/main_scene="uid://u5h6iqyi8wd0"
+config/features=PackedStringArray("4.4", "C#", "Forward Plus")
config/icon="res://icon.svg"
[dotnet]
project/assembly_name="projeto-fantasia"
+
+[input]
+
+walk-up={
+"deadzone": 0.2,
+"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194320,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
+]
+}
+walk-down={
+"deadzone": 0.2,
+"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194322,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
+]
+}
+walk-left={
+"deadzone": 0.2,
+"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194319,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
+]
+}
+walk-right={
+"deadzone": 0.2,
+"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194321,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
+]
+}
+skip-turn={
+"deadzone": 0.2,
+"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":46,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
+]
+}
+
+[rendering]
+
+textures/canvas_textures/default_texture_filter=0
diff --git a/projeto-fantasia.csproj b/projeto-fantasia.csproj
new file mode 100644
index 0000000..800a3c6
--- /dev/null
+++ b/projeto-fantasia.csproj
@@ -0,0 +1,7 @@
+<Project Sdk="Godot.NET.Sdk/4.4.1">
+ <PropertyGroup>
+ <TargetFramework>net8.0</TargetFramework>
+ <EnableDynamicLoading>true</EnableDynamicLoading>
+ <RootNamespace>projetofantasia</RootNamespace>
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/projeto-fantasia.sln b/projeto-fantasia.sln
new file mode 100644
index 0000000..1097a72
--- /dev/null
+++ b/projeto-fantasia.sln
@@ -0,0 +1,19 @@
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2012
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "projeto-fantasia", "projeto-fantasia.csproj", "{3C8F29E9-A5E7-47BA-9DFC-53821760AA87}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ ExportDebug|Any CPU = ExportDebug|Any CPU
+ ExportRelease|Any CPU = ExportRelease|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {3C8F29E9-A5E7-47BA-9DFC-53821760AA87}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {3C8F29E9-A5E7-47BA-9DFC-53821760AA87}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {3C8F29E9-A5E7-47BA-9DFC-53821760AA87}.ExportDebug|Any CPU.ActiveCfg = ExportDebug|Any CPU
+ {3C8F29E9-A5E7-47BA-9DFC-53821760AA87}.ExportDebug|Any CPU.Build.0 = ExportDebug|Any CPU
+ {3C8F29E9-A5E7-47BA-9DFC-53821760AA87}.ExportRelease|Any CPU.ActiveCfg = ExportRelease|Any CPU
+ {3C8F29E9-A5E7-47BA-9DFC-53821760AA87}.ExportRelease|Any CPU.Build.0 = ExportRelease|Any CPU
+ EndGlobalSection
+EndGlobal
diff --git a/scenes/character.tscn b/scenes/character.tscn
new file mode 100644
index 0000000..4b23758
--- /dev/null
+++ b/scenes/character.tscn
@@ -0,0 +1,12 @@
+[gd_scene load_steps=3 format=3 uid="uid://bl01llfbscv6r"]
+
+[ext_resource type="Texture2D" uid="uid://dwky8qc2y602k" path="res://assets/sprites/character.png" id="1_agfs1"]
+[ext_resource type="Script" uid="uid://c840l08453pu2" path="res://scripts/Character.cs" id="2_rkhd4"]
+
+[node name="Character" type="Sprite2D" groups=["TimeSlave"]]
+texture_filter = 1
+texture = ExtResource("1_agfs1")
+script = ExtResource("2_rkhd4")
+
+[node name="Camera2D" type="Camera2D" parent="."]
+zoom = Vector2(4, 4)
diff --git a/scenes/skeleton.tscn b/scenes/skeleton.tscn
new file mode 100644
index 0000000..1dc7727
--- /dev/null
+++ b/scenes/skeleton.tscn
@@ -0,0 +1,8 @@
+[gd_scene load_steps=3 format=3 uid="uid://bsn4a4tfensy8"]
+
+[ext_resource type="Texture2D" uid="uid://dh5sgjdwkps88" path="res://assets/sprites/skeleton.png" id="1_pbvs3"]
+[ext_resource type="Script" uid="uid://bef1fo3vgvxej" path="res://scripts/Enemy.cs" id="2_txkty"]
+
+[node name="Skeleton" type="Sprite2D" groups=["TimeSlave"]]
+texture = ExtResource("1_pbvs3")
+script = ExtResource("2_txkty")
diff --git a/scenes/test_map.tscn b/scenes/test_map.tscn
new file mode 100644
index 0000000..a5c4039
--- /dev/null
+++ b/scenes/test_map.tscn
@@ -0,0 +1,29 @@
+[gd_scene load_steps=6 format=4 uid="uid://u5h6iqyi8wd0"]
+
+[ext_resource type="TileSet" uid="uid://biilh0ufacguh" path="res://assets/test_tileset.tres" id="1_57l66"]
+[ext_resource type="Script" uid="uid://dwubb28wt4bhe" path="res://scripts/DungeonLevel.cs" id="1_p21b5"]
+[ext_resource type="PackedScene" uid="uid://bl01llfbscv6r" path="res://scenes/character.tscn" id="2_fn2sa"]
+[ext_resource type="PackedScene" uid="uid://bsn4a4tfensy8" path="res://scenes/skeleton.tscn" id="3_57l66"]
+[ext_resource type="PackedScene" uid="uid://ie3vpgatjvkw" path="res://scenes/turn_manager.tscn" id="4_p21b5"]
+
+[node name="DungeonLevel" type="Node2D"]
+script = ExtResource("1_p21b5")
+
+[node name="Map" type="TileMapLayer" parent="."]
+texture_filter = 1
+tile_map_data = PackedByteArray("AAAHAAcAAAAAAAAAAAAIAAcAAAAAAAAAAAAJAAcAAAAAAAAAAAAKAAcAAAAAAAAAAAALAAcAAAAAAAAAAAAMAAcAAAAAAAAAAAANAAcAAAAAAAAAAAAOAAcAAAAAAAAAAAAOAAgAAAAAAAAAAAANAAgAAAAAAAAAAAAMAAgAAAAAAAAAAAALAAgAAAAAAAAAAAAKAAgAAAAAAAAAAAAJAAgAAAAAAAAAAAAIAAgAAAAAAAAAAAAHAAgAAAAAAAAAAAAHAAkAAAAAAAAAAAAIAAkAAAAAAAAAAAAKAAkAAAAAAAAAAAALAAkAAAAAAAAAAAAMAAkAAAAAAAAAAAANAAkAAAAAAAAAAAAOAAkAAAAAAAAAAAAJAAkAAAAAAAAAAAAGAAYAAAABAAAAAAAGAAcAAAABAAAAAAAGAAgAAAAAAAAAAAAGAAkAAAABAAAAAAAGAAoAAAABAAAAAAAHAAoAAAABAAAAAAAIAAoAAAABAAAAAAAJAAoAAAABAAAAAAANAAoAAAABAAAAAAAOAAoAAAABAAAAAAAPAAoAAAABAAAAAAAPAAkAAAABAAAAAAAPAAgAAAABAAAAAAAPAAcAAAABAAAAAAAPAAYAAAABAAAAAAAOAAYAAAABAAAAAAANAAYAAAABAAAAAAAMAAYAAAABAAAAAAALAAYAAAABAAAAAAAKAAYAAAABAAAAAAAJAAYAAAABAAAAAAAIAAYAAAABAAAAAAAHAAYAAAABAAAAAAAMAAoAAAABAAAAAAALAAoAAAAAAAAAAAAKAAoAAAABAAAAAAAFAAgAAAAAAAAAAAAEAAgAAAAAAAAAAAAEAAkAAAAAAAAAAAAEAAoAAAAAAAAAAAAEAAsAAAAAAAAAAAAEAAwAAAAAAAAAAAAEAA0AAAAAAAAAAAAEAA4AAAAAAAAAAAAFAA4AAAAAA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AAAAAA=")
+tile_set = ExtResource("1_57l66")
+
+[node name="Skeleton" parent="." node_paths=PackedStringArray("Map") instance=ExtResource("3_57l66")]
+position = Vector2(120, 121)
+Map = NodePath("../Map")
+
+[node name="Character" parent="." node_paths=PackedStringArray("Map") instance=ExtResource("2_fn2sa")]
+position = Vector2(135, 135)
+Map = NodePath("../Map")
+
+[node name="TurnManager" parent="." instance=ExtResource("4_p21b5")]
+
+[connection signal="actionPerformed" from="Skeleton" to="TurnManager" method="OnActionEnd"]
+[connection signal="actionPerformed" from="Character" to="TurnManager" method="OnActionEnd"]
+[connection signal="turnEnd" from="TurnManager" to="." method="OnTurnEnd"]
diff --git a/scenes/turn_manager.tscn b/scenes/turn_manager.tscn
new file mode 100644
index 0000000..4a1cf5c
--- /dev/null
+++ b/scenes/turn_manager.tscn
@@ -0,0 +1,6 @@
+[gd_scene load_steps=2 format=3 uid="uid://ie3vpgatjvkw"]
+
+[ext_resource type="Script" uid="uid://ynjn2pmluvf6" path="res://scripts/TurnManager.cs" id="1_3c2a3"]
+
+[node name="TurnManager" type="Node"]
+script = ExtResource("1_3c2a3")
diff --git a/scripts/Actor.cs b/scripts/Actor.cs
new file mode 100644
index 0000000..b360545
--- /dev/null
+++ b/scripts/Actor.cs
@@ -0,0 +1,35 @@
+using Godot;
+
+public abstract partial class Actor : Node2D {
+ static int baseWalkCost = 10;
+ [Export]
+ public TileMapLayer Map { get; set; }
+ [Signal]
+ public delegate void actionPerformedEventHandler();
+
+ [Export]
+ public int Energy { get; set; } = 0;
+ [Export]
+ public int Speed { get; protected set; } = 10;
+
+ protected void Walk(Vector2I offset) {
+ Vector2I toMovePos = Map.LocalToMap(Position);
+ toMovePos += offset;
+
+ TileData tile = Map.GetCellTileData(toMovePos);
+
+ if (tile.HasCustomData("isWalkable") && (bool) tile.GetCustomData("isWalkable")) {
+ GD.Print(toMovePos);
+ Position = Map.MapToLocal(toMovePos);
+ }
+
+ Energy -= baseWalkCost;
+ EndAction();
+ }
+
+ protected virtual void EndAction() {
+ EmitSignal(SignalName.actionPerformed);
+ }
+
+ public abstract void performAction();
+} \ No newline at end of file
diff --git a/scripts/Actor.cs.uid b/scripts/Actor.cs.uid
new file mode 100644
index 0000000..cf29b40
--- /dev/null
+++ b/scripts/Actor.cs.uid
@@ -0,0 +1 @@
+uid://c0cm4woy8lawl
diff --git a/scripts/Character.cs b/scripts/Character.cs
new file mode 100644
index 0000000..172ffe4
--- /dev/null
+++ b/scripts/Character.cs
@@ -0,0 +1,51 @@
+using Godot;
+using System;
+
+public partial class Character : Actor {
+ private bool canAct = false;
+
+ public override void _Input(InputEvent @event)
+ {
+ base._Input(@event);
+
+ if (!@event.IsPressed()) return;
+
+ if (canAct) {
+
+
+ if (@event.IsActionPressed("walk-up")) {
+ Walk(Vector2I.Up);
+ }
+ if (@event.IsActionPressed("walk-down")) {
+ Walk(Vector2I.Down);
+ }
+ if (@event.IsActionPressed("walk-left")) {
+ Walk(Vector2I.Left);
+ }
+ if (@event.IsActionPressed("walk-right")) {
+ GD.Print("Hello!");
+ Walk(Vector2I.Right);
+ }
+
+ if (@event.IsActionPressed("skip-turn")) {
+ SkipTurn();
+ }
+ }
+ }
+
+ private void SkipTurn() {
+ GD.Print("Skipped the turn.");
+ Energy = 0;
+ EndAction();
+ }
+
+ protected override void EndAction() {
+ canAct = false;
+ base.EndAction();
+ }
+
+ public override void performAction() {
+ GD.Print("I can act");
+ canAct = true;
+ }
+}
diff --git a/scripts/Character.cs.uid b/scripts/Character.cs.uid
new file mode 100644
index 0000000..8229b7f
--- /dev/null
+++ b/scripts/Character.cs.uid
@@ -0,0 +1 @@
+uid://c840l08453pu2
diff --git a/scripts/DungeonLevel.cs b/scripts/DungeonLevel.cs
new file mode 100644
index 0000000..c3536ac
--- /dev/null
+++ b/scripts/DungeonLevel.cs
@@ -0,0 +1,18 @@
+using Godot;
+using System;
+
+public partial class DungeonLevel : Node2D {
+ TurnManager turnManager;
+
+ public override void _Ready() {
+ base._Ready();
+
+ turnManager = GetNode<TurnManager>("TurnManager");
+
+ turnManager.Tick();
+ }
+
+ public void OnTurnEnd() {
+ turnManager.Tick();
+ }
+}
diff --git a/scripts/DungeonLevel.cs.uid b/scripts/DungeonLevel.cs.uid
new file mode 100644
index 0000000..5c3c2a2
--- /dev/null
+++ b/scripts/DungeonLevel.cs.uid
@@ -0,0 +1 @@
+uid://dwubb28wt4bhe
diff --git a/scripts/Enemy.cs b/scripts/Enemy.cs
new file mode 100644
index 0000000..52eb27f
--- /dev/null
+++ b/scripts/Enemy.cs
@@ -0,0 +1,10 @@
+using Godot;
+using System;
+
+public partial class Enemy : Actor {
+ public override void performAction() {
+ Walk(Vector2I.Right);
+
+ GD.Print("Energy after walking: " + Energy);
+ }
+}
diff --git a/scripts/Enemy.cs.uid b/scripts/Enemy.cs.uid
new file mode 100644
index 0000000..93255b7
--- /dev/null
+++ b/scripts/Enemy.cs.uid
@@ -0,0 +1 @@
+uid://bef1fo3vgvxej
diff --git a/scripts/TurnManager.cs b/scripts/TurnManager.cs
new file mode 100644
index 0000000..ffb2659
--- /dev/null
+++ b/scripts/TurnManager.cs
@@ -0,0 +1,61 @@
+using Godot;
+using System;
+using System.Collections.Generic;
+using System.Reflection.Metadata.Ecma335;
+
+public partial class TurnManager : Node {
+ [Signal]
+ public delegate void turnBeginEventHandler();
+ [Signal]
+ public delegate void turnEndEventHandler();
+
+ private Godot.Collections.Array<Node> actors = [];
+ private int index = 0;
+
+ public int TurnCount { get; private set; } = 1;
+
+ public void Tick() {
+ EmitSignal(SignalName.turnBegin);
+
+ GD.Print("Turn: " + TurnCount);
+
+ actors.Clear();
+ actors = GetTree().GetNodesInGroup("TimeSlave");
+
+ GD.Print("Actor count: " + actors.Count);
+
+ index = -1;
+ NextActor();
+ }
+
+ private void NextActor() {
+ index++;
+ GD.Print("Index: " + index);
+ if (index >= actors.Count) {
+ EndTurn();
+ return;
+ }
+ Actor currentActor = (Actor) actors[index];
+ currentActor.Energy += currentActor.Speed;
+ ActorPerformAction();
+ }
+
+ private void ActorPerformAction() {
+ Actor currentActor = (Actor) actors[index];
+ if (currentActor.Energy > 0) {
+ currentActor.performAction();
+ } else {
+ NextActor();
+ }
+ }
+
+ public void OnActionEnd() {
+ ActorPerformAction();
+ }
+
+ private void EndTurn() {
+ GD.Print("Turn End");
+ TurnCount++;
+ EmitSignal(SignalName.turnEnd);
+ }
+}
diff --git a/scripts/TurnManager.cs.uid b/scripts/TurnManager.cs.uid
new file mode 100644
index 0000000..a306f3e
--- /dev/null
+++ b/scripts/TurnManager.cs.uid
@@ -0,0 +1 @@
+uid://ynjn2pmluvf6