summaryrefslogtreecommitdiff
path: root/scripts/entities/actors/Enemy.cs
diff options
context:
space:
mode:
authorMatheus <matheus.guedes.mg.m@gmail.com>2025-09-04 16:18:17 -0300
committerMatheus <matheus.guedes.mg.m@gmail.com>2025-09-04 16:18:17 -0300
commit9953c9a5818baa392a48a4d18339c73f3b7a814e (patch)
tree3484fbca78bfa217d84226cc774119fe054f6df9 /scripts/entities/actors/Enemy.cs
parent7dbe2bbe431f77deb3515e5cf0810cfa07215d59 (diff)
Prepare
Diffstat (limited to 'scripts/entities/actors/Enemy.cs')
-rw-r--r--scripts/entities/actors/Enemy.cs55
1 files changed, 55 insertions, 0 deletions
diff --git a/scripts/entities/actors/Enemy.cs b/scripts/entities/actors/Enemy.cs
new file mode 100644
index 0000000..19bcd2c
--- /dev/null
+++ b/scripts/entities/actors/Enemy.cs
@@ -0,0 +1,55 @@
+using Godot;
+using System;
+
+/// <summary>
+/// Enum das diferentes IAs disponíveis.
+/// </summary>
+public enum AIType
+{
+ None,
+ DefaultHostile
+};
+
+/// <summary>
+/// Um inimigo é uma espécie de ator que é
+/// hostil ao jogador. Inimigos são controlados por IA.
+/// </summary>
+public partial class Enemy : Actor
+{
+ /// <summary>
+ /// A alma do ator. Gera ações que são executadas todo turno.
+ /// </summary>
+ public BaseAI Soul { get; private set; }
+
+ public Enemy(Vector2I initialPosition, MapData map, EnemyDefinition definition) : base(initialPosition, map, definition)
+ {
+ SetDefinition(definition);
+ }
+
+ /// <summary>
+ /// Além de definir as características gerais de um ator,
+ /// também define qual IA utilizar.
+ /// </summary>
+ /// <param name="definition">Definição do inimigo.</param>
+ public void SetDefinition(EnemyDefinition definition)
+ {
+ // Definimos as características do ator.
+ base.SetDefinition(definition);
+
+ // Definimos qual IA utilizar.
+ switch(definition.AI) {
+ case AIType.None:
+ break;
+ case AIType.DefaultHostile:
+ Soul = new HostileEnemyAI();
+ AddChild(Soul);
+ break;
+ }
+ }
+
+ public override void Die() {
+ Soul.QueueFree();
+ Soul = null;
+ base.Die();
+ }
+}