コード例 #1
0
        static void Main(string[] args)
        {
            Soliders soliders         = new Soliders();
            Command  combinateCommand = new CombinateCommand(soliders);
            Command  fightCommand     = new FightCommand(soliders);
            Command  cableBoatCommand = new CableBoatCommand(soliders);

            //设置传令官
            Herald herald = new Herald();

            //集合
            herald.SetCommand(combinateCommand);
            //herald.Notify();

            //战斗
            herald.SetCommand(fightCommand);
            herald.SetCommand(fightCommand);
            // herald.Notify();

            //铁索连舟
            herald.SetCommand(cableBoatCommand);
            //herald.Notify();
            herald.Notify();
            Console.WriteLine("取消命令!");
            herald.CancelCommand(cableBoatCommand);
            herald.Notify();

            Reciver    reciver = new Reciver();
            AbsCommand command = new ConcreteCommand(reciver);
            Invoker    invoker = new Invoker();

            invoker.SetCommand(command);
            invoker.ExecuteCommand();
        }
コード例 #2
0
ファイル: Command.cs プロジェクト: zxsean/Unity3DTraining
 public CableBoatCommand(Soliders soliders) : base(soliders)
 {
 }
コード例 #3
0
ファイル: Command.cs プロジェクト: zxsean/Unity3DTraining
 public FightCommand(Soliders soliders) : base(soliders)
 {
 }
コード例 #4
0
ファイル: Command.cs プロジェクト: zxsean/Unity3DTraining
 public CombinateCommand(Soliders soliders) : base(soliders)
 {
 }
コード例 #5
0
ファイル: Command.cs プロジェクト: zxsean/Unity3DTraining
 public Command(Soliders soliders)
 {
     this.soliders = soliders;
 }