Advertisement
alexbancheva

Engine_WeaponFactory

Aug 5th, 2021
1,481
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.75 KB | None | 0 0
  1. namespace WeaponsFactory.Core
  2. {
  3.     using System;
  4.     using System.Collections.Generic;
  5.     using System.Linq;
  6.     using System.Text;
  7.     using System.Threading.Tasks;
  8.     using WeaponsFactory.Factories;
  9.  
  10.     public class Engine : IEngine
  11.     {
  12.         private WeaponFactory weaponFactory;
  13.  
  14.         public Engine()
  15.         {
  16.             this.weaponFactory = new WeaponFactory();
  17.         }
  18.  
  19.         public void Run()
  20.         {
  21.             var input = Console.ReadLine()
  22.                .Split(" ", StringSplitOptions.RemoveEmptyEntries).ToArray();
  23.  
  24.             var weapon = this.weaponFactory.CreateWeapon(input[0]);
  25.             var result = weapon.InflictDamage(int.Parse(input[1]));
  26.             Console.WriteLine(result);
  27.         }
  28.     }
  29. }
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement