public AsteroidFactory(Game gameView_) { gameView = gameView_; //poolManager = new PoolManager<AsteroidModel, AsteroidController>(CreateNewAsteroid); PoolLocator.Add <AsteroidModel, AsteroidController>(CreateNewAsteroid); rnd = new System.Random(); }
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); }