diff --git a/Assets/Scripts/Command/CommandInvoker.cs b/Assets/Scripts/Command/CommandInvoker.cs new file mode 100644 index 00000000..594b7d5d --- /dev/null +++ b/Assets/Scripts/Command/CommandInvoker.cs @@ -0,0 +1,16 @@ +public class CommandInvoker { + private Stack commandHistory = new Stack(); + + public void ProcessCommand(ICommand command) { + ExecuteCommand(command); + RegisterCommand(command); + } + + private void ExecuteCommand(ICommand command) { + command.Execute(); + } + + private void RegisterCommand(ICommand command) { + commandHistory.Push(command); + } +} \ No newline at end of file diff --git a/Assets/Scripts/Command/ICommand.cs b/Assets/Scripts/Command/ICommand.cs new file mode 100644 index 00000000..ee93b73b --- /dev/null +++ b/Assets/Scripts/Command/ICommand.cs @@ -0,0 +1,4 @@ +interface ICommand +{ + void Execute(); +} \ No newline at end of file diff --git a/Assets/Scripts/Command/IUnitCommand.cs b/Assets/Scripts/Command/IUnitCommand.cs new file mode 100644 index 00000000..ae69506c --- /dev/null +++ b/Assets/Scripts/Command/IUnitCommand.cs @@ -0,0 +1,13 @@ +public class IUnitCommand : ICommand +{ + public int ActorUnitId { get; set; } + public int TargetUnitId { get; set; } + public int ActorPlayerId { get; set; } + public int TargetPlayerId { get; set; } + + protected UnitController actor; + protected UnitController target; + + public abstract void Execute(); + public abstract bool WillHitTarget(); +} \ No newline at end of file