Ejemplo n.º 1
0
 void Awake()
 {
     SampleHole            = SampleHoleInspector;
     SampleTown            = SampleTownInspector;
     LevelElementsInstance = GetComponent <LevelElements>();
 }
Ejemplo n.º 2
0
        private bool SpawnScenery()
        {
            _elements = LevelsMgr.LevelElementsInstance;

            //Populate elements to spawn
            List <SpawnSceneryItem> pinnaclesToSpawn = new List <SpawnSceneryItem>();

            foreach (Scenery s in _elements.SamplePinacles)
            {
                pinnaclesToSpawn.Add(new SpawnSceneryItem()
                {
                    SampleObject          = s,
                    Number                = (int)(10 / _elements.SamplePinacles.Length),
                    SizeVariance          = 1.75f,
                    RotationAngleVariance = 5, //degrees
                    RadiusOnMap           = 300,
                    RadiusWidth           = 100
                });
            }

            //Spawn & Combine
            CombineObjects("Nature - Pinnacles", SpawnElements(pinnaclesToSpawn), LevelNatureMaterial);

            //Populate elements to spawn
            List <SpawnSceneryItem> rocksToSpawn = new List <SpawnSceneryItem>();

            foreach (Scenery s in _elements.SampleRocks)
            {
                rocksToSpawn.Add(new SpawnSceneryItem()
                {
                    SampleObject          = s,
                    Number                = (int)(50 / _elements.SampleRocks.Length),
                    SizeVariance          = 1.5f,
                    RotationAngleVariance = 5, //degrees
                    RadiusOnMap           = 250,
                    RadiusWidth           = 200
                });
            }

            //Spawn & Combine
            CombineObjects("Nature - Rocks", SpawnElements(rocksToSpawn), LevelNatureMaterial);

            //TODO: lay out trees for forests perhaps according to a better distribution noise function versus straight radius random
            //Populate elements to spawn
            List <SpawnSceneryItem> treesToSpawn = new List <SpawnSceneryItem>();

            foreach (Scenery s in _elements.SampleForestPine)
            {
                treesToSpawn.Add(new SpawnSceneryItem()
                {
                    SampleObject          = s,
                    Number                = (int)(50 / _elements.SampleForestPine.Length),
                    SizeVariance          = 1.75f,
                    RotationAngleVariance = 359, //degrees
                    RadiusOnMap           = 250 + (PlayerUser.LastLevelCompleted * 15),
                    RadiusWidth           = 100
                });
            }

            //Spawn & Combine
            CombineObjects("Nature - Trees", SpawnElements(treesToSpawn), LevelNatureMaterial);

            //Populate elements to spawn
            List <SpawnSceneryItem> treesInnerToSpawn = new List <SpawnSceneryItem>();

            foreach (Scenery s in _elements.SampleForestTrees)
            {
                treesInnerToSpawn.Add(new SpawnSceneryItem()
                {
                    SampleObject          = s,
                    Number                = (int)(100 / _elements.SampleForestTrees.Length),
                    SizeVariance          = 1.75f,
                    RotationAngleVariance = 359, //degrees
                    RadiusOnMap           = 125 + (PlayerUser.LastLevelCompleted * 15),
                    RadiusWidth           = 50
                });
            }

            //Spawn & Combine
            CombineObjects("Nature - TreesInner", SpawnElements(treesInnerToSpawn), LevelNatureMaterial);

            //Populate elements to spawn
            List <SpawnSceneryItem> treesInner2ToSpawn = new List <SpawnSceneryItem>();

            foreach (Scenery s in _elements.SampleForestTrees)
            {
                treesInner2ToSpawn.Add(new SpawnSceneryItem()
                {
                    SampleObject          = s,
                    Number                = (int)(100 / _elements.SampleForestTrees.Length),
                    SizeVariance          = 1.75f,
                    RotationAngleVariance = 359, //degrees
                    RadiusOnMap           = 100 + (PlayerUser.LastLevelCompleted * 15),
                    RadiusWidth           = 50
                });
            }

            //Spawn & Combine
            CombineObjects("Nature - TreesInner", SpawnElements(treesInner2ToSpawn), LevelNatureMaterial);

            return(true);
        }