コード例 #1
0
        private void ExecuteCommand(Command command)
        {
            switch (command.Action)
            {
            case ActionName.Attack:
                AttackOutcome attackOutcome = _warriorClient.Attack(command.Strength);
                WarriorLogger.AttackLogging(attackOutcome, command.Strength);
                break;

            case ActionName.Defend:
                DefenseOutcome defenseOutcome = _warriorClient.Defend(command.Time);
                WarriorLogger.DefenceLogging(defenseOutcome);
                break;

            case ActionName.Rest:
                RestOutcome restOutcome = _warriorClient.Rest(command.Time);
                WarriorLogger.RestLogging(restOutcome);
                break;

            case ActionName.Check:
                WarriorState warriorState = _warriorClient.Check();
                WarriorLogger.CheckLogging(warriorState);
                break;
            }
        }
コード例 #2
0
        public static void RestLogging(RestOutcome outcome)
        {
            switch (outcome)
            {
            case RestOutcome.Success:
                Logger.Info("You have succefully rested ");
                break;

            case RestOutcome.Interrupted:
                Logger.Info("You got interrupted while resting");
                break;

            case RestOutcome.WrongData:
                WrongRestData();
                break;

            case RestOutcome.BattleNotStarted:
                BattleNotStarted();
                break;
            }
        }