public void ExecuteCommand(GameActor actor) { foreach (var command in commandList) { command.execute(actor); } commandList.Clear(); }
public static void Main2(string[] args) { GameActor actor = new GameActor(); JumpCommand jump = new JumpCommand(); FireCommand fire = new FireCommand(); SwapCommand swap = new SwapCommand(); LurchCommand lurch = new LurchCommand(); InputHandler handler = new InputHandler(); handler.TakeCommand(jump); handler.TakeCommand(fire); handler.TakeCommand(swap); handler.TakeCommand(lurch); handler.ExecuteCommand(actor); }
public void execute(GameActor actor) { actor.Lurch(); }
public void execute(GameActor actor) { actor.Swap(); }
public void execute(GameActor actor) { actor.Fire(); }
public void execute(GameActor actor) //接口方法默认Public,实现接口必须实现与之对应的函数。 { actor.Jump(); }