Example #1
0
 public void AddModel(AsteroidModel model)
 {
     if (!models.Contains(model))
     {
         models.Add(model);
     }
 }
Example #2
0
        public IController GetAsteroid()
        {
            AsteroidController asteroidController;
            AsteroidModel      model = models[rnd.Next(0, models.Count)];
            PoolManager <AsteroidModel, AsteroidController> poolManager = PoolLocator.Get <AsteroidModel, AsteroidController>();

            asteroidController = poolManager.GetOrCreate(model);
            asteroidController.Initialize();
            return(asteroidController);
        }
Example #3
0
        private void SpawnAsteroids()
        {
            asteroidFactory = new AsteroidFactory(gameView);
            AsteroidModel model  = new AsteroidModel();
            AsteroidModel model2 = new AsteroidModel("Asteroid2");

            asteroidFactory.AddModel(model);
            asteroidFactory.AddModel(model2);
            for (int i = 0; i < 5; i++)
            {
                asteroidFactory.GetAsteroid();
            }
        }
Example #4
0
 private AsteroidController CreateNewAsteroid(AsteroidModel model)
 {
     return(new AsteroidController(model, gameView.CreateView(model.Name)));
 }