Example #1
0
        static void Main(string[] args)
        {
            CombatLogger logger = new CombatLogger();

            IHandler handler = new Handler();

            logger.SetSuccessor(handler);
            logger.Handle(LogType.ATTACK, "Hello");

            Logger combatLog = new CombatLogger();
            Logger eventLog  = new EventLogger();

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

            warrior.SetTarget(dragon);
            dragon.Register(warrior);

            warrior.Attack();

            IExecutor executor = new CommandExecutor();
            ICommand  command  = new TargetCommand(warrior, dragon);
            ICommand  attack   = new AttackCommand(warrior);
        }
Example #2
0
        public static IHandler GenerateLogChain()
        {
            var combatLogger = new CombatLogger();
            var eventLogger  = new EventLogger();

            combatLogger.SetSuccessor(eventLogger);

            return(combatLogger);
        }
Example #3
0
        static void Main(string[] args)
        {
            var combatLog = new CombatLogger();
            var eventLog  = new EventLogger();

            combatLog.SetSuccessor(eventLog);

            var warrior = new Warrior("Nikola", 50, combatLog);
            var dragon  = new Dragon("Yoan", 60, 20, combatLog);

            IExecutor executor = new CommandExecutor();
            ICommand  command  = new TargetCommand(warrior, dragon);
            ICommand  attack   = new AttackComand(warrior);
        }
Example #4
0
        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("ivan", 100, 25, combatLog);

            IExecutor executor = new CommandExecutor();
            ICommand  command  = new TargetCommand(warrior, dragon);
            ICommand  attack   = new AttackCommand(warrior);
        }
Example #5
0
        public static void Main()
        {
            var combatLogger = new CombatLogger();

            combatLogger.Handle(LogType.MAGIC, "f**k you");
        }