Пример #1
0
        private void OnJobComplete(Job job)
        {
            if (job.JobObjectPrototype.GetType() == typeof(Wall))
            {
                Wall wall = job.JobObjectPrototype as Wall;

                TerrainManager.AddWall(wall.Type, job.Tile);
            }

            job.JobComplete -= OnJobComplete;
            job.JobCancel   -= OnJobCancel;
            _jobs.Remove(job);
            job = null;
        }
Пример #2
0
        /// <summary>
        /// Creates the caves and minerals.
        /// </summary>
        /// <param name="worldX">The world x.</param>
        /// <param name="worldY">The world y.</param>
        /// <returns></returns>
        private void CreateCaves(Tile tile, int worldX, int worldY)
        {
            // Do some magic
            float octave4 = SimplexNoise.noise(worldX * 0.01f, worldY * 0.01f) * 0.12f;
            float octave5 = SimplexNoise.noise(worldX * 0.03f, worldY * 0.03f) * octave4;
            float noise   = octave4 + octave5;

            // If below a certain threshold, create minerals
            if (noise < 0.04 && noise > 0.03f)
            {
                TerrainManager.AddWall(LinkedSpriteType.IronOre, tile);
            }
            else if (noise < 0.045 && noise > 0.04f)
            {
                TerrainManager.AddWall(LinkedSpriteType.Cave, tile);
            }
            else if (noise < 0.055 && noise > 0.045f)
            {
                TerrainManager.AddWall(LinkedSpriteType.StoneOre, tile);
            }
            else if (noise < 0.065 && noise > 0.055f)
            {
                TerrainManager.AddWall(LinkedSpriteType.CoalOre, tile);
            }
            else if (noise < 0.09 && noise > 0.065f)
            {
                TerrainManager.AddWall(LinkedSpriteType.Cave, tile);
            }
            else if (noise < 0.13 && noise > 0.09f)
            {
                TerrainManager.AddWall(LinkedSpriteType.StoneOre, tile);
            }
            else if (noise < 0.15 && noise > 0.13f)
            {
                TerrainManager.AddWall(LinkedSpriteType.Cave, tile);
            }
        }