예제 #1
0
        private void SpawnAsteroid()
        {
            //TODO: Don't create an asteroid within the minimum radius of the player.
            float x = UnityEngine.Random.Range(0f, Config.instance.width);
            float y = UnityEngine.Random.Range(0f, Config.instance.height);

            context.CreateAsteroidRandomized(x, y, isBig: true);
        }
        protected override void Execute(List <GameEntity> entities)
        {
            foreach (var e in entities)
            {
                var type = e.spawnEntityWhenDestroyed.entity;
                var pos  = e.position;

                switch (type)
                {
                case EntityFactoryType.SmallAsteroid:
                    for (int i = 0; i < e.spawnEntityWhenDestroyed.count; i++)
                    {
                        context.CreateAsteroidRandomized(pos.x, pos.y, isBig: false);
                    }
                    break;
                }
            }
        }