public void AddModel(AsteroidModel model) { if (!models.Contains(model)) { models.Add(model); } }
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); }
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(); } }
private AsteroidController CreateNewAsteroid(AsteroidModel model) { return(new AsteroidController(model, gameView.CreateView(model.Name))); }