コード例 #1
0
        public string ManufactureFighter(string name, double attackPoints, double defensePoints)
        {
            Fighter fighter = null;
            var     message = string.Format(OutputMessages.MachineExists, name);

            if (!this.machineRepository.Contains(name))
            {
                fighter = (Fighter)fighterFactory.Create(name, attackPoints, defensePoints);
                this.machineRepository.AddUnit(fighter);

                message = string.Format(OutputMessages.FighterManufactured,
                                        name, fighter.AttackPoints, fighter.DefensePoints, fighter.Mode);
            }

            return(message);
        }