示例#1
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();
            }
        }
示例#2
0
        private void ExampleFactory()
        {
            Enemy.CreateAsteroidEnemy(new Health(100.0f, 100.0f));

            IEnemyFactory factory = new AsteroidFactory();

            factory.Create(new Health(100.0f, 100.0f));

            Enemy.Factory.Create(new Health(100.0f, 100.0f));

            new PlatformFactory().Create(Application.platform);

            System.Threading.Tasks.Task.Factory.StartNew(() => Debug.Log("Test"));
        }
        private void Start()
        {
            EnemyPool enemyPool = new EnemyPool(5);
            var       enemy     = enemyPool.GetEnemy("Asteroid");

            enemy.transform.position = Vector3.one;
            enemy.gameObject.SetActive(true);
            return;

            Enemy.CreateAsteroidEnemy(new Health(100.0f, 100.0f));

            IEnemyFactory factory = new AsteroidFactory();

            factory.Create(new Health(100.0f, 100.0f));

            Enemy.Factory.Create(new Health(100.0f, 100.0f));


            var platform = new PlatformFactory().Create(Application.platform);

            System.Threading.ThreadPool.QueueUserWorkItem(state => Debug.Log("Test"));
        }