示例#1
0
 internal static void PrintBodyPartsStat(IInhabitant inhabitant)
 {
     foreach (var bodyPart in inhabitant.Body)
     {
         ConsoleHelper.LogMessage("{0}: Health - {1}/{2}hp, Defense - {3} ", bodyPart.Title, bodyPart.Health, bodyPart.MaxHealth, bodyPart.Defense);
     }
 }
示例#2
0
        public void Run()
        {
            string input = Console.ReadLine();

            var inhabitants = new List <IInhabitant>();

            while (input != "End")
            {
                IInhabitant inhabitant = inhabitantFactory.CreateInhabitant(input);

                inhabitants.Add(inhabitant);

                input = Console.ReadLine();
            }

            input = Console.ReadLine();
            foreach (var item in inhabitants)
            {
                if (item.Id.EndsWith($"{input}"))
                {
                    Console.WriteLine(item.Id);
                }
            }
        }
示例#3
0
 internal static int GetTotalHealth(IInhabitant inhabitant)
 {
     return(inhabitant.Body.Sum(x => x.Health));
 }