예제 #1
0
        public void AddPlanet(IPlanetFactory factory, Vector2 position, float radius)
        {
            Planet p = factory.Create(this, position, radius);

            this.Planets.AddLast(p);
            this.AddWorldObject(p.ID, p);
        }
예제 #2
0
        public MainPresenter(IPlanetFactory planetFactory, ICamera camera, ICameraController cameraController, IWindowManager windowManager, Statistics statistics, ISettings settings)
        {
            _planetFactory    = planetFactory;
            _camera           = camera;
            _cameraController = cameraController;
            _windowManager    = windowManager;
            _statistics       = statistics;

            _settings = settings;
            _settings.ShouldUpdate = true;
        }
예제 #3
0
        public MainPresenter(IPlanetFactory planetFactory, ICamera camera, ICameraController cameraController, IWindowManager windowManager, Statistics statistics, ISettings settings)
        {
            _planetFactory = planetFactory;
            _camera = camera;
            _cameraController = cameraController;
            _windowManager = windowManager;
            _statistics = statistics;

            _settings = settings;
            _settings.ShouldUpdate = true;
        }
 public BatchSpaceObjectFactory(
     IRandomGenerator randomGenerator,
     IMonsterFactory monsterFactory,
     IPlanetFactory planetFactory,
     int probPlanet)
 {
     this.randomGenerator = randomGenerator;
     this.monsterFactory  = monsterFactory;
     this.planetFactory   = planetFactory;
     this.probPlanet      = probPlanet;
 }
예제 #5
0
        public PlanetRepository(IPlanetFactory planetFactory, ITreeOfLifeSession session)
        {
            _session = session;

            _planets = new ReadOnlyCollection<Planet>(new List<Planet>
            {
                planetFactory.Create("Planets/1", 12, "Mercury", '\u263F'),
                planetFactory.Create("Planets/2", 13, "Moon", '\u263E'),
                planetFactory.Create("Planets/3", 14, "Venus", '\u2640'),
                planetFactory.Create("Planets/4", 21, "Jupiter", '\u2643'),
                planetFactory.Create("Planets/5", 27, "Mars", '\u2642'),
                planetFactory.Create("Planets/6", 30, "Sun", '\u2609'),
                planetFactory.Create("Planets/7", 32, "Saturn", '\u2644')
            });
        }
        public Controller(
            AstronautRepository astronautRepository,
            PlanetRepository planetRepository,
            IAstronautFactory astronautFactory,
            IPlanetFactory planetFactory,
            IMission mission)
        {
            this.astronautRepository = astronautRepository;
            this.planetRepository    = planetRepository;

            this.astronautFactory = astronautFactory;
            this.planetFactory    = planetFactory;

            this.mission = mission;
        }
예제 #7
0
파일: Game.cs 프로젝트: L4fter/Orb
    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;
    }
예제 #8
0
        public TestController(IUserSessionService userSessionService, IKernel kernel) : base(userSessionService)
        {
            #region b1

            try
            {
                _commandCenter = kernel.Get <ICommandCenter>();
                _injectMessages.Add("ICommandCenter", _commandCenter.Test());
            }
            catch (Exception e)
            {
                _injectMessages.Add("exeption ICommandCenter", e.Message);
                throw new Exception(_injectMessages.ToSerealizeString());
            }

            try
            {
                _gameUserService = kernel.Get <IGameUserService>();
                _injectMessages.Add("IGameUserService", _gameUserService.Test());
            }
            catch (Exception e)
            {
                _injectMessages.Add("exeption IUserChestHelper", e.Message);

                throw new Exception(_injectMessages.ToSerealizeString());
            }

            #endregion

            #region b2

            try
            {
                _gDetailPlanetService = kernel.Get <IGDetailPlanetService>();
                _injectMessages.Add("IGDetailPlanetService", _gDetailPlanetService.Test());
            }
            catch (Exception e)
            {
                _injectMessages.Add("exeption IGDetailPlanetService", e.Message);

                throw new Exception(_injectMessages.ToSerealizeString());
            }
            try
            {
                _industrialComplex = kernel.Get <IIndustrialComplex>();
                _injectMessages.Add("IIndustrialComplex", _industrialComplex.Test());
            }
            catch (Exception e)
            {
                _injectMessages.Add("exeption IIndustrialComplex", e.Message);

                throw new Exception(_injectMessages.ToSerealizeString());
            }
            try
            {
                _motherFactory = kernel.Get <IMotherFactory>();
                _injectMessages.Add("IMotherFactory", _motherFactory.Test());
            }
            catch (Exception e)
            {
                _injectMessages.Add("exeption IMotherFactory", e.Message);

                throw new Exception(_injectMessages.ToSerealizeString());
            }
            try
            {
                _mothershipService = kernel.Get <IMothershipService>();
                _injectMessages.Add("IMothershipService", _mothershipService.Test());
            }
            catch (Exception e)
            {
                _injectMessages.Add("exeption IMothershipService", e.Message);

                throw new Exception(_injectMessages.ToSerealizeString());
            }

            #endregion

            #region b3

            try
            {
                _planetFactory = kernel.Get <IPlanetFactory>();
                _injectMessages.Add("IPlanetFactory", _planetFactory.Test());
            }
            catch (Exception e)
            {
                _injectMessages.Add("exeption IPlanetFactory", e.Message);

                throw new Exception(_injectMessages.ToSerealizeString());
            }

            try
            {
                _shipyard = kernel.Get <IShipyard>();
                _injectMessages.Add("IShipyard", _shipyard.Test());
            }
            catch (Exception e)
            {
                _injectMessages.Add("exeption IShipyard", e.Message);

                throw new Exception(_injectMessages.ToSerealizeString());
            }
            try
            {
                _storage = kernel.Get <IStorage>();
                _injectMessages.Add("IStorage", _storage.Test());
            }
            catch (Exception e)
            {
                _injectMessages.Add("exeption IStorage", e.Message);

                throw new Exception(_injectMessages.ToSerealizeString());
            }

            #endregion

            #region b4

            try
            {
                _storageResourcesService = kernel.Get <IStorageResourcesService>();
                _injectMessages.Add("IStorageResourcesService", _storageResourcesService.Test());
            }
            catch (Exception e)
            {
                _injectMessages.Add("exeption IStorageResourcesService", e.Message);

                throw new Exception(_injectMessages.ToSerealizeString());
            }
            try
            {
                _synchronizer = kernel.Get <ISynchronizer>();

                _injectMessages.Add("ISynchronizer", _synchronizer.Test());
            }
            catch (Exception e)
            {
                _injectMessages.Add("exeption ISynchronizer", e.Message);

                throw new Exception(_injectMessages.ToSerealizeString());
            }
            try
            {
                _gSectorsService = kernel.Get <IGSectorsService>();
                _injectMessages.Add("IGSectorsService", _gSectorsService.Test());
            }
            catch (Exception e)
            {
                _injectMessages.Add("exeption IGSectorsService", e.Message);

                throw new Exception(_injectMessages.ToSerealizeString());
            }
            try
            {
                _systemService = kernel.Get <ISystemService>();
                _injectMessages.Add("ISystemService", _systemService.Test());
            }
            catch (Exception e)
            {
                _injectMessages.Add("exeption ISystemService", e.Message);

                throw new Exception(_injectMessages.ToSerealizeString());
            }

            #endregion

            #region b5

            try
            {
                _mapAdressService = kernel.Get <IMapAdressService>();
                _injectMessages.Add("IMapAdressService", _mapAdressService.Test());
            }
            catch (Exception e)
            {
                _injectMessages.Add("exeption IMapAdressService", e.Message);

                throw new Exception(_injectMessages.ToSerealizeString());
            }

            #endregion

            #region b6


            try
            {
                _npcInitializer = kernel.Get <INpcInitializer>();
                _injectMessages.Add("INpcInitializer", _npcInitializer.Test());
            }
            catch (Exception e)
            {
                _injectMessages.Add("exeption INpcInitializer", e.Message);

                throw new Exception(_injectMessages.ToSerealizeString());
            }


            try
            {
                _mapGInitializer = kernel.Get <IMapGInitializer>();
                _injectMessages.Add("IMapGInitializer", _mapGInitializer.Test());
            }
            catch (Exception e)
            {
                _injectMessages.Add("exeption IMapGInitializer", e.Message);

                throw new Exception(_injectMessages.ToSerealizeString());
            }


            try
            {
                _mainInitializer = kernel.Get <IMainInitializer>();
                _injectMessages.Add("IMainInitializer", _mainInitializer.Test());
            }
            catch (Exception e)
            {
                _injectMessages.Add("exeption IMainInitializer", e.Message);

                throw new Exception(_injectMessages.ToSerealizeString());
            }

            #endregion

            #region b7

            try
            {
                _authUsersInitializer = kernel.Get <IAuthUsersInitializer>();
                _injectMessages.Add("IAuthUsersInitializer", _authUsersInitializer.Test());
            }
            catch (Exception e)
            {
                _injectMessages.Add("exeption IAuthUsersInitializer", e.Message);
                throw new Exception(_injectMessages.ToSerealizeString());
            }

            try
            {
                _allianceService = kernel.Get <IAllianceService>();
                _injectMessages.Add("IAllianceService", _allianceService.Test());
            }
            catch (Exception e)
            {
                _injectMessages.Add("exeption IAllianceService", e.Message);
                throw new Exception(_injectMessages.ToSerealizeString());
            }

            #endregion
        }
예제 #9
0
파일: Serializer.cs 프로젝트: L4fter/Orb
    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);
    }