summaryrefslogtreecommitdiff
path: root/scripts/actors/Enemy.cs
blob: 6c111b1b9288bef0e22d71d28a7d557f13b2270e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
using Godot;
using System;

public enum AIType
{
	None,
	DefaultHostile
};

public partial class Enemy : Actor
{
	public BaseAI Soul { get; private set; }

	public bool IsAlive { get => Soul != null; }

	public Enemy(Vector2I initialPosition, MapData map, EnemyDefinition definition) : base(initialPosition, map, definition)
	{
		SetDefinition(definition);
	}

	public void SetDefinition(EnemyDefinition definition)
	{
		base.SetDefinition(definition);

		switch(definition.AI) {
			case AIType.None:
				break;
			case AIType.DefaultHostile:
				Soul = new HostileEnemyAI();
				AddChild(Soul);
				break;
		}
	}
}