public CelestialSystem CreateFromSerialized(IProjectileFactory projectileFactory, IPlanetFactory planetFactory, IWeaponFactory weaponFactory) { var celestialSystem = resolver.Resolve <CelestialSystem>(); var planets = new List <IPlanet>(); var central = scs.planets.First(planet => planet.isCentral); var centralStarPlanet = planetFactory.CreatePlanet(central.entity.pos); central.entity.FillIn(centralStarPlanet.SimulatedEntity); celestialSystem.AddCentralStar(centralStarPlanet); foreach (var serializedPlanet in scs.planets.Except(new [] { central })) { var appearance = new PlanetAppearance() { color = serializedPlanet.color }; var planet = planetFactory.CreatePlanet(serializedPlanet.entity.pos, appearance); weaponFactory.AddWeapon(serializedPlanet.weaponType, planet); serializedPlanet.entity.FillIn(planet.SimulatedEntity); planets.Add(planet); } celestialSystem.AddRaw(planets); projectileFactory.celestialSystem = celestialSystem; foreach (var projectile in scs.projectiles) { var proj = projectileFactory.CreateBullet(projectile.entity.pos); projectile.entity.FillIn(proj); } return(celestialSystem); }
public ProjectileSpawner(IInstantiator instantiator, IProjectileFactory projectileFactory, SignalBus signalBus) { this.projectileFactory = projectileFactory; this.instantiator = instantiator; this.signalBus = signalBus; SubscribeToDestroySignal(); }
public void Construct(IProjectileFactory projectileFactory, IInputService inputService, Camera camera) { this.projectileFactory = projectileFactory; this.camera = camera; this.inputService = inputService; projectileFactory.Load(); Subscribe(); }
private Engine() { this.enemies = EnemiesProvider.Instance; this.terrain = TerrainProvider.Instance; this.terrainGenerator = TerrainGenerator.Instance; this.drawer = new ConsoleDrawer(); this.projectileFactory = new ProjectileFactory(); this.terrain.Terrain = terrainGenerator.GenerateRandomMap(Constants.TerrainCountOnMap).ToList(); this.mover = Mover.Instance; this.firstPlayer = this.terrainGenerator.GenerateFirstPlayer(); this.secondPlayer = this.terrainGenerator.GenerateSecondPlayer(); }
public void EnemyProjectileDetection(List <IEnemy> EnemyList, IProjectileFactory projectileFactory) { this.EnemyList = EnemyList; this.projectileFactory = projectileFactory; List <IProjectile> projectileList = projectileFactory.ProjectileList; foreach (IEnemy enemy in EnemyList) { if (enemy.exist) { foreach (IProjectile projectile in projectileList) { Rectangle EnemyRectangle = enemy.GetRectangle(); Rectangle projectileRectangle = projectile.GetRectangle(); ICollision side = new GeneralDetection(EnemyRectangle, projectileRectangle).ifCollision(); IHandler EnemyProjectileCollision = new EnemyProjectileCollisonHandler(enemy, projectile, side); EnemyProjectileCollision.Execute(); } } } }
public void OnViewReady() { Debug.Log("View ready"); // Injecting stuff that couldnt be created before the game // Mostly from scene, which is loaded later at unknown time planetFactory = resolver.Resolve <IPlanetFactory>(); projectileFactory = resolver.Resolve <IProjectileFactory>(); weaponFactory = resolver.Resolve <IWeaponFactory>(); if (csProvider.HasSerializedCelestialSystem) { CreateCelestialSystemFromSerialized(); } else { CreateCelestialSystemFromScene(); } projectileFactory.celestialSystem = celestialSystem; }
public void Init(IPlanet planet, IProjectileFactory projectileFactory) { this.planet = planet; this.projectileFactory = projectileFactory; }
public PlayerProjectilesManager(IProjectileFactory projectileFactory, ICollisionSystem collisionSystem) { _projectileFactory = projectileFactory ?? throw new ArgumentNullException(nameof(projectileFactory)); _collisionSystem = collisionSystem ?? throw new ArgumentNullException(nameof(collisionSystem)); }
public void Construct(IProjectileFactory <Bullet> bulletFactory, IShootFrom shootFrom, IShootingTarget target) { _bulletFactory = bulletFactory; _shootFrom = shootFrom; _target = target; }