예제 #1
0
        public void ExecuteCommand(GameActor actor)
        {
            foreach (var command in commandList)
            {
                command.execute(actor);
            }

            commandList.Clear();
        }
예제 #2
0
        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);
        }
예제 #3
0
 public void execute(GameActor actor)
 {
     actor.Lurch();
 }
예제 #4
0
 public void execute(GameActor actor)
 {
     actor.Swap();
 }
예제 #5
0
 public void execute(GameActor actor)
 {
     actor.Fire();
 }
예제 #6
0
 public void execute(GameActor actor)  //接口方法默认Public,实现接口必须实现与之对应的函数。
 {
     actor.Jump();
 }