예제 #1
0
        public void Init(
            IEnumerable <PlanetContext> planets,
            GravitySystem gravitySystem,
            SystemsUpdater systemsUpdater,
            HealthsContainer healthsContainer,
            RocketState[] rocketsStates
            )
        {
            MovementSystem = new RocketsMovementSystem(gravitySystem);
            systemsUpdater.AddPhysicsTicker(MovementSystem);
            _rocketsFactory = new RocketsFactory(
                _rockets,
                MovementSystem,
                _rocketsParent,
                healthsContainer,
                _cameraTransform
                );
            _rocketsFactory.CreateRockets(rocketsStates);

            foreach (var planet in planets)
            {
                planet.CannonProvider.SetFactory(_rocketsFactory);
                var cannon = planet.CannonProvider.GetCannon();
                systemsUpdater.AddFrameTicker(cannon);
            }
        }
예제 #2
0
 private void CreateAIs(PlanetsStorage planetsStorage, SystemsUpdater systemsUpdater)
 {
     var aiStorage = new AIStorage(
         planetsStorage.GetAIContexts(),
         systemsUpdater,
         _aiFireInterval
         );
 }
예제 #3
0
        public AIStorage(
            IEnumerable <PlanetContext> planetsContext,
            SystemsUpdater systemsUpdater,
            Range fireInterval
            )
        {
            _systemsUpdater = systemsUpdater;
            _ais            = new SortedDictionary <int, AIController>();

            foreach (var planet in planetsContext)
            {
                var cannon = planet.CannonProvider.GetCannon();
                var ai     = new AIController(cannon, fireInterval);
                _systemsUpdater.AddFrameTicker(ai);
                _ais.Add(planet.Id, ai);
            }
        }
예제 #4
0
 public void Init(PlanetsStorage planetsStorage, SystemsUpdater systemsUpdater)
 {
     CreatePlayer(planetsStorage);
     CreateAIs(planetsStorage, systemsUpdater);
 }