예제 #1
0
        public static void Main()
        {
            Logger combatLog = new CombatLogger();
            Logger eventlog  = new EventLogger();

            combatLog.SetSuccessor(eventlog);

            IAttacker warrior = new Warrior("Gencho", 10, combatLog);
            ITarget   dragon  = new Dragon("Lamia", 100, 25, combatLog);

            IExecutor executor = new CommandExecutor();
            ICommand  command  = new TargetCommand(warrior, dragon);
            ICommand  attack   = new AttackCommand(warrior);
        }
예제 #2
0
파일: StartUp.cs 프로젝트: kmyumyun/SoftUni
        public static void Main(string[] args)
        {
            Logger combatLog = new CombatLogger();
            Logger eventLog  = new EventLogger();

            combatLog.SetSuccessor(eventLog);

            var warrior = new Warrior("gosho", 10, combatLog);
            var dragon  = new Dragon("Peter", 100, 25, combatLog);

            IExecutor executor = new CommandExecutor();
            ICommand  command  = new TargetCommand(warrior, dragon);
            ICommand  attack   = new AttackCommand(warrior);
        }
예제 #3
0
        public static void Main(string[] args)
        {
            IHandler combatLogger = new CombatLogger();
            IHandler eventLogger  = new CombatLogger();

            combatLogger.SetSuccessor(eventLogger);

            IAttackGroup attackGroup = new Group();

            IAttacker warrior  = new Warrior("gosho", 10, combatLogger);
            IAttacker attacker = new Warrior("atanas", 100, combatLogger);

            attackGroup.AddMember(warrior);
            attackGroup.AddMember(attacker);

            ITarget dragon = new Dragon("Peter", 100, 25, combatLogger);

            IExecutor executor = new CommandExecutor();

            ICommand command            = new TargetCommand(warrior, dragon);
            ICommand attack             = new AttackCommand(warrior);
            ICommand groupTargetCommand = new GroupTargetCommand(attackGroup, dragon);
            ICommand groupAttackCommand = new GroupAttackCommand(attackGroup);
        }