public Game(ICollection <string> userIds, IMapInfo mapInfo, IGameSettings settings) { if (userIds == null) { throw new ArgumentNullException(nameof(userIds)); } if (mapInfo == null) { throw new ArgumentNullException(nameof(mapInfo)); } if (settings == null) { throw new ArgumentNullException(nameof(settings)); } this.actionPoints = settings.ActionPoints; var tanks = userIds.Select(x => new Tank(new Health(settings.TankHealthPoint), x)).ToArray(); var map = new Map(new MapCreationData(mapInfo, tanks), new BattlefieldBuilder(), new RandomSpawnService()); // намерено скрываем типы используемых интерфейсов внутри класса игры this.mapAdapter = new MapAdapter(map); this.bulletService = new BulletService(this.mapAdapter, settings.BulletActionPoints); this.moveService = new MoveService(this.mapAdapter); this.zoneService = new ZoneService(this.mapAdapter, settings.ZoneRadius); this.DestroyedObjects = new DestroyedInfo(new Dictionary <string, Coordinates>(), new ICellContentInfo[0]); }
public InventoryController(IBrassService iBrassService, IBulletService iBulletService, ICartridgeLoadService iCartridgeLoadService, ICartridgeService iCartridgeService, IPowderService iPowderService, IPrimerService iPrimerService) { this.brassService = iBrassService; this.bulletService = iBulletService; this.cartridgeLoadService = iCartridgeLoadService; this.cartridgeService = iCartridgeService; this.powderService = iPowderService; this.primerService = iPrimerService; }
public InventoryController() { this.brassService = new BrassService(); this.bulletService = new BulletService(); this.cartridgeLoadService = new CartridgeLoadService(); this.cartridgeService = new CartridgeService(); this.powderService = new PowderService(); this.primerService = new PrimerService(); }
public void Start() { bulletService = new BulletService(this, bulletPrefab); tankService = new TankService(this, tankPrefab); }
public BulletController(IBulletService ibulletService) { this.service = ibulletService; }