Example #1
0
 public void Initialize(MapCoordinates mapCoordinates, SpawnPointGenerator spawnPointGenerator,
                        StartForceGenerator startForceGenerator)
 {
     _rigidbody           = gameObject.GetComponent <Rigidbody2D>();
     _spawnPointGenerator = spawnPointGenerator;
     _startForceGenerator = startForceGenerator;
     _mapCoordinates      = mapCoordinates;
 }
Example #2
0
        public void Initialize(MapCoordinates mapCoordinates, ITarget target, ScoreCounter scoreCounter)
        {
            _time         = 0f;
            currentStage  = 0;
            _target       = target;
            _scoreCounter = scoreCounter;

            _startForceGenerator = new StartForceGenerator(mapCoordinates, minStartForce, maxStartForce);
            _spawnPointGenerator = new SpawnPointGenerator(mapCoordinates, spawnPointOffset);
            _mapCoordinates      = mapCoordinates;

            void UfoInitialization(Ufo ufo) => ufo.Initialize(_spawnPointGenerator, _target);
            void AsteroidInitialization(Asteroid asteroid) => asteroid.Initialize(_mapCoordinates, _spawnPointGenerator, _startForceGenerator);

            _ufosManager     = _ufosManager ?? new PoolManager <Ufo>(ufoPrefab, UfoInitialization, startUfoCount);
            _asteroidManager = _asteroidManager ?? new PoolManager <Asteroid>(asteroidPrefab, AsteroidInitialization, startAsteroidCount);
        }