-
Notifications
You must be signed in to change notification settings - Fork 69
Expand file tree
/
Copy pathActionService.cs
More file actions
34 lines (29 loc) · 1.2 KB
/
ActionService.cs
File metadata and controls
34 lines (29 loc) · 1.2 KB
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 Command.Input;
using System.Collections.Generic;
namespace Command.Actions
{
public class ActionService
{
private Dictionary<CommandType, IAction> actions;
public ActionService() => CreateActions();
private void CreateActions()
{
actions = new Dictionary<CommandType, IAction>();
actions.Add(CommandType.Attack, new AttackAction());
actions.Add(CommandType.Heal, new HealAction());
actions.Add(CommandType.AttackStance, new AttackStanceAction());
actions.Add(CommandType.Cleanse, new CleanseAction());
actions.Add(CommandType.Meditate, new MeditateAction());
actions.Add(CommandType.BerserkAttack, new BerserkAttackAction());
actions.Add(CommandType.ThirdEye, new ThirdEyeAction());
}
public IAction GetActionByType(CommandType type)
{
if (actions.ContainsKey(type))
return actions[type];
else
throw new System.Exception($"No Action found for the type {type} in the dictionary");
}
public TargetType GetTargetTypeForAction(CommandType actionType) => actions[actionType].TargetType;
}
}