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