public static void InitializeDefaultLibrary(GraphicsDevice graphics, Texture2D cubeTexture) { if (PrimitiveMap.Count > 0) return; BoxPrimitive grassCube = CreatePrimitive(graphics, cubeTexture, 32, 32, new Point(0, 0), new Point(2, 0), new Point(2, 0)); BoxPrimitive dirtCube = CreatePrimitive(graphics, cubeTexture, 32, 32, new Point(2, 0), new Point(2, 0), new Point(2, 0)); BoxPrimitive stoneCube = CreatePrimitive(graphics, cubeTexture, 32, 32, new Point(4, 2), new Point(1, 0), new Point(4, 2)); BoxPrimitive sandCube = CreatePrimitive(graphics, cubeTexture, 32, 32, new Point(1, 1), new Point(1, 1), new Point(1, 1)); BoxPrimitive ironCube = CreatePrimitive(graphics, cubeTexture, 32, 32, new Point(4, 1), new Point(1, 2), new Point(4, 1)); BoxPrimitive goldCube = CreatePrimitive(graphics, cubeTexture, 32, 32, new Point(3, 1), new Point(0, 2), new Point(3, 1)); BoxPrimitive coalCube = CreatePrimitive(graphics, cubeTexture, 32, 32, new Point(3, 2), new Point(2, 2), new Point(2, 2)); BoxPrimitive manaCube = CreatePrimitive(graphics, cubeTexture, 32, 32, new Point(7, 1), new Point(6, 1), new Point(7, 1)); BoxPrimitive frostCube = CreatePrimitive(graphics, cubeTexture, 32, 32, new Point(0, 1), new Point(2, 1), new Point(2, 0)); BoxPrimitive scaffoldCube = CreatePrimitive(graphics, cubeTexture, 32, 32, new Point(7, 0), new Point(7, 0), new Point(7, 0)); BoxPrimitive plankCube = CreatePrimitive(graphics, cubeTexture, 32, 32, new Point(4, 0), new Point(4, 0), new Point(4, 0)); BoxPrimitive waterCube = CreatePrimitive(graphics, cubeTexture, cubeTexture.Width, cubeTexture.Height, new Point(0, 0), new Point(0, 0), new Point(0, 0)); BoxPrimitive cobblestoneCube = CreatePrimitive(graphics, cubeTexture, 32, 32, new Point(5, 2), new Point(5, 2), new Point(5, 2)); BoxPrimitive magicCube = CreatePrimitive(graphics, cubeTexture, 32, 32, new Point(0, 10), new Point(0, 10), new Point(0, 10)); BoxPrimitive bedrockCube = CreatePrimitive(graphics, cubeTexture, 32, 32, new Point(6, 2), new Point(6, 2), new Point(6, 2)); BoxPrimitive brownTileCube = CreatePrimitive(graphics, cubeTexture, 32, 32, new Point(5, 0), new Point(5, 0), new Point(5, 0)); BoxPrimitive blueTileCube = CreatePrimitive(graphics, cubeTexture, 32, 32, new Point(6, 0), new Point(6, 0), new Point(6, 0)); BoxPrimitive tilledSoilCube = CreatePrimitive(graphics, cubeTexture, 32, 32, new Point(5, 1), new Point(2, 0), new Point(2, 0)); emptyType = new VoxelType { Name = "empty", ReleasesResource = false, IsBuildable = false }; VoxelType tilledSoil = new VoxelType { Name = "TilledSoil", ReleasesResource = false, StartingHealth = 20, CanRamp = true, IsBuildable = false, ParticleType = "dirt_particle", IsSoil = true }; RegisterType(tilledSoil, tilledSoilCube); VoxelType brownTileFloor = new VoxelType { Name = "BrownTileFloor", ReleasesResource = false, StartingHealth = 20, CanRamp = false, IsBuildable = false, ParticleType = "stone_particle" }; RegisterType(brownTileFloor, brownTileCube); VoxelType blueTileFloor = new VoxelType { Name = "BlueTileFloor", ReleasesResource = false, StartingHealth = 20, CanRamp = false, IsBuildable = false, ParticleType = "stone_particle" }; RegisterType(blueTileFloor, blueTileCube); VoxelType cobblestoneFloor = new VoxelType { Name = "CobblestoneFloor", ReleasesResource = false, StartingHealth = 20, CanRamp = false, IsBuildable = false, ParticleType = "stone_particle", HasTransitionTextures = true }; RegisterType(cobblestoneFloor, cobblestoneCube); CreateTransitionUVs(graphics, cubeTexture, 32, 32, new Point(0, 8), new Point(5, 2), new Point(5, 2), cobblestoneFloor.TransitionTextures); VoxelType stockpileType = new VoxelType { Name = "Stockpile", ReleasesResource = false, StartingHealth = 20, CanRamp = false, IsBuildable = false, ParticleType = "stone_particle", HasTransitionTextures = true }; RegisterType(stockpileType, plankCube); CreateTransitionUVs(graphics, cubeTexture, 32, 32, new Point(0, 9), new Point(4, 0), new Point(4, 0), stockpileType.TransitionTextures); VoxelType plankType = new VoxelType { Name = "Plank", ProbabilityOfRelease = 1.0f, ResourceToRelease = ResourceLibrary.ResourceType.Wood, StartingHealth = 20, ReleasesResource = true, CanRamp = true, RampSize = 0.5f, IsBuildable = true, ParticleType = "stone_particle", HasTransitionTextures = true }; CreateTransitionUVs(graphics, cubeTexture, 32, 32, new Point(0, 9), new Point(4, 0), new Point(4, 0), plankType.TransitionTextures); VoxelType magicType = new VoxelType { Name = "Magic", ProbabilityOfRelease = 0.0f, ResourceToRelease = ResourceLibrary.ResourceType.Mana, StartingHealth = 1, ReleasesResource = true, CanRamp = false, IsBuildable = false, ParticleType = "star_particle", ExplosionSound = ContentPaths.Audio.wurp, HasTransitionTextures = false, EmitsLight = true }; CreateTransitionUVs(graphics, cubeTexture, 32, 32, new Point(0, 10), new Point(15, 10), new Point(15, 10), magicType.TransitionTextures); VoxelType scaffoldType = new VoxelType { Name = "Scaffold", StartingHealth = 20, ProbabilityOfRelease = 1.0f, ResourceToRelease = ResourceLibrary.ResourceType.Wood, ReleasesResource = false, CanRamp = false, RampSize = 0.5f, IsBuildable = true, ParticleType = "stone_particle" }; VoxelType grassType = new VoxelType { Name = "Grass", ProbabilityOfRelease = 0.1f, ResourceToRelease = ResourceLibrary.ResourceType.Dirt, StartingHealth = 10, ReleasesResource = true, CanRamp = true, RampSize = 0.5f, IsBuildable = false, ParticleType = "dirt_particle", HasTransitionTextures = true, IsSoil = true }; CreateTransitionUVs(graphics, cubeTexture, 32, 32, new Point(0, 3), new Point(2, 0), new Point(2, 0), grassType.TransitionTextures); VoxelType frostType = new VoxelType { Name = "Frost", ProbabilityOfRelease = 0.1f, ResourceToRelease = ResourceLibrary.ResourceType.Dirt, StartingHealth = 10, ReleasesResource = true, CanRamp = true, RampSize = 0.5f, IsBuildable = false, ParticleType = "dirt_particle", HasTransitionTextures = true }; CreateTransitionUVs(graphics, cubeTexture, 32, 32, new Point(0, 4), new Point(2, 0), new Point(2, 0), frostType.TransitionTextures); VoxelType desertGrass = new VoxelType { Name = "DesertGrass", ProbabilityOfRelease = 0.1f, ResourceToRelease = ResourceLibrary.ResourceType.Sand, StartingHealth = 10, ReleasesResource = true, CanRamp = true, RampSize = 0.5f, IsBuildable = false, ParticleType = "sand_particle", HasTransitionTextures = true }; CreateTransitionUVs(graphics, cubeTexture, 32, 32, new Point(0, 6), new Point(1, 1), new Point(1, 1), desertGrass.TransitionTextures); VoxelType jungleGrass = new VoxelType { Name = "JungleGrass", ProbabilityOfRelease = 0.1f, ResourceToRelease = ResourceLibrary.ResourceType.Dirt, StartingHealth = 10, ReleasesResource = true, CanRamp = true, RampSize = 0.5f, IsBuildable = false, ParticleType = "dirt_particle", HasTransitionTextures = true }; CreateTransitionUVs(graphics, cubeTexture, 32, 32, new Point(0, 5), new Point(2, 0), new Point(2, 0), jungleGrass.TransitionTextures); VoxelType dirtType = new VoxelType { Name = "Dirt", ReleasesResource = true, ResourceToRelease = ResourceLibrary.ResourceType.Dirt, ProbabilityOfRelease = 0.3f, StartingHealth = 10, RampSize = 0.5f, CanRamp = true, IsBuildable = true, ParticleType = "dirt_particle", IsSoil = true }; VoxelType stoneType = new VoxelType { Name = "Stone", ProbabilityOfRelease = 0.5f, ReleasesResource = true, ResourceToRelease = ResourceLibrary.ResourceType.Stone, StartingHealth = 30, IsBuildable = true, ParticleType = "stone_particle" }; VoxelType bedrockType = new VoxelType { Name = "Bedrock", StartingHealth = 255, IsBuildable = false, IsInvincible = true }; VoxelType waterType = new VoxelType { Name = "water", ReleasesResource = false, IsBuildable = false, StartingHealth = 255 }; VoxelType sandType = new VoxelType { Name = "Sand", ReleasesResource = false, StartingHealth = 5, CanRamp = true, RampSize = 0.5f, IsBuildable = false, ParticleType = "sand_particle" }; VoxelType ironType = new VoxelType { Name = "Iron", ProbabilityOfRelease = 0.99f, ReleasesResource = true, ResourceToRelease = ResourceLibrary.ResourceType.Iron, StartingHealth = 80, IsBuildable = false, ParticleType = "stone_particle" }; ResourceSpawns["Iron"] = new ResourceSpawnRate { VeinSize = 0.2f, VeinSpawnThreshold = 0.9f, MinimumHeight = -100, MaximumHeight = 100, Probability = 0.5f }; VoxelType coalType = new VoxelType { Name = "Coal", ProbabilityOfRelease = 0.99f, ReleasesResource = true, ResourceToRelease = ResourceLibrary.ResourceType.Coal, StartingHealth = 75, IsBuildable = false, ParticleType = "stone_particle" }; ResourceSpawns["Coal"] = new ResourceSpawnRate { VeinSize = 0.085f, VeinSpawnThreshold = 0.9f, MinimumHeight = -100, MaximumHeight = 100, Probability = 0.5f }; VoxelType goldType = new VoxelType { Name = "Gold", ProbabilityOfRelease = 1.0f, ReleasesResource = true, ResourceToRelease = ResourceLibrary.ResourceType.Gold, StartingHealth = 90, IsBuildable = false, ParticleType = "stone_particle" }; ResourceSpawns["Gold"] = new ResourceSpawnRate { VeinSize = 0.07f, VeinSpawnThreshold = 0.8f, MinimumHeight = -150, MaximumHeight = 15, Probability = 0.6f }; VoxelType manaType = new VoxelType { Name = "Mana", ProbabilityOfRelease = 1.0f, ReleasesResource = true, ResourceToRelease = ResourceLibrary.ResourceType.Mana, StartingHealth = 200, IsBuildable = false, ParticleType = "stone_particle" }; ResourceSpawns["Mana"] = new ResourceSpawnRate { VeinSize = 0.05f, VeinSpawnThreshold = 0.85f, MinimumHeight = -800, MaximumHeight = 8, Probability = 0.5f }; RegisterType(grassType, grassCube); RegisterType(frostType, frostCube); RegisterType(desertGrass, grassCube); RegisterType(jungleGrass, grassCube); RegisterType(emptyType, null); RegisterType(dirtType, dirtCube); RegisterType(stoneType, stoneCube); RegisterType(waterType, waterCube); RegisterType(sandType, sandCube); RegisterType(ironType, ironCube); RegisterType(goldType, goldCube); RegisterType(manaType, manaCube); RegisterType(plankType, plankCube); RegisterType(scaffoldType, scaffoldCube); RegisterType(bedrockType, bedrockCube); RegisterType(coalType, coalCube); RegisterType(magicType, magicCube); foreach (VoxelType type in VoxelType.TypeList) { Types[type.Name] = type; } }
public static void InitializeDefaultLibrary(GraphicsDevice graphics, Texture2D cubeTexture) { if (PrimitiveMap.Count > 0) { return; } BoxPrimitive grassCube = CreatePrimitive(graphics, cubeTexture, 32, 32, new Point(0, 0), new Point(2, 0), new Point(2, 0)); BoxPrimitive dirtCube = CreatePrimitive(graphics, cubeTexture, 32, 32, new Point(2, 0), new Point(2, 0), new Point(2, 0)); BoxPrimitive stoneCube = CreatePrimitive(graphics, cubeTexture, 32, 32, new Point(4, 2), new Point(1, 0), new Point(4, 2)); BoxPrimitive sandCube = CreatePrimitive(graphics, cubeTexture, 32, 32, new Point(1, 1), new Point(1, 1), new Point(1, 1)); BoxPrimitive ironCube = CreatePrimitive(graphics, cubeTexture, 32, 32, new Point(4, 1), new Point(1, 2), new Point(4, 1)); BoxPrimitive goldCube = CreatePrimitive(graphics, cubeTexture, 32, 32, new Point(3, 1), new Point(0, 2), new Point(3, 1)); BoxPrimitive coalCube = CreatePrimitive(graphics, cubeTexture, 32, 32, new Point(3, 2), new Point(2, 2), new Point(2, 2)); BoxPrimitive manaCube = CreatePrimitive(graphics, cubeTexture, 32, 32, new Point(7, 1), new Point(6, 1), new Point(7, 1)); BoxPrimitive frostCube = CreatePrimitive(graphics, cubeTexture, 32, 32, new Point(0, 1), new Point(2, 1), new Point(2, 0)); BoxPrimitive scaffoldCube = CreatePrimitive(graphics, cubeTexture, 32, 32, new Point(7, 0), new Point(7, 0), new Point(7, 0)); BoxPrimitive plankCube = CreatePrimitive(graphics, cubeTexture, 32, 32, new Point(4, 0), new Point(4, 0), new Point(4, 0)); BoxPrimitive waterCube = CreatePrimitive(graphics, cubeTexture, cubeTexture.Width, cubeTexture.Height, new Point(0, 0), new Point(0, 0), new Point(0, 0)); BoxPrimitive cobblestoneCube = CreatePrimitive(graphics, cubeTexture, 32, 32, new Point(5, 2), new Point(5, 2), new Point(5, 2)); BoxPrimitive magicCube = CreatePrimitive(graphics, cubeTexture, 32, 32, new Point(0, 10), new Point(0, 10), new Point(0, 10)); BoxPrimitive bedrockCube = CreatePrimitive(graphics, cubeTexture, 32, 32, new Point(6, 2), new Point(6, 2), new Point(6, 2)); BoxPrimitive brownTileCube = CreatePrimitive(graphics, cubeTexture, 32, 32, new Point(5, 0), new Point(5, 0), new Point(5, 0)); BoxPrimitive blueTileCube = CreatePrimitive(graphics, cubeTexture, 32, 32, new Point(6, 0), new Point(6, 0), new Point(6, 0)); BoxPrimitive tilledSoilCube = CreatePrimitive(graphics, cubeTexture, 32, 32, new Point(5, 1), new Point(2, 0), new Point(2, 0)); emptyType = new VoxelType { Name = "empty", ReleasesResource = false, IsBuildable = false }; VoxelType tilledSoil = new VoxelType { Name = "TilledSoil", ReleasesResource = false, StartingHealth = 20, CanRamp = true, IsBuildable = false, ParticleType = "dirt_particle", IsSoil = true }; RegisterType(tilledSoil, tilledSoilCube); VoxelType brownTileFloor = new VoxelType { Name = "BrownTileFloor", ReleasesResource = false, StartingHealth = 20, CanRamp = false, IsBuildable = false, ParticleType = "stone_particle" }; RegisterType(brownTileFloor, brownTileCube); VoxelType blueTileFloor = new VoxelType { Name = "BlueTileFloor", ReleasesResource = false, StartingHealth = 20, CanRamp = false, IsBuildable = false, ParticleType = "stone_particle" }; RegisterType(blueTileFloor, blueTileCube); VoxelType cobblestoneFloor = new VoxelType { Name = "CobblestoneFloor", ReleasesResource = false, StartingHealth = 20, CanRamp = false, IsBuildable = false, ParticleType = "stone_particle", HasTransitionTextures = true }; RegisterType(cobblestoneFloor, cobblestoneCube); CreateTransitionUVs(graphics, cubeTexture, 32, 32, new Point(0, 8), new Point(5, 2), new Point(5, 2), cobblestoneFloor.TransitionTextures); VoxelType stockpileType = new VoxelType { Name = "Stockpile", ReleasesResource = false, StartingHealth = 20, CanRamp = false, IsBuildable = false, ParticleType = "stone_particle", HasTransitionTextures = true }; RegisterType(stockpileType, plankCube); CreateTransitionUVs(graphics, cubeTexture, 32, 32, new Point(0, 9), new Point(4, 0), new Point(4, 0), stockpileType.TransitionTextures); VoxelType plankType = new VoxelType { Name = "Plank", ProbabilityOfRelease = 1.0f, ResourceToRelease = ResourceLibrary.ResourceType.Wood, StartingHealth = 20, ReleasesResource = true, CanRamp = true, RampSize = 0.5f, IsBuildable = true, ParticleType = "stone_particle", HasTransitionTextures = true }; CreateTransitionUVs(graphics, cubeTexture, 32, 32, new Point(0, 9), new Point(4, 0), new Point(4, 0), plankType.TransitionTextures); VoxelType magicType = new VoxelType { Name = "Magic", ProbabilityOfRelease = 0.0f, ResourceToRelease = ResourceLibrary.ResourceType.Mana, StartingHealth = 1, ReleasesResource = true, CanRamp = false, IsBuildable = false, ParticleType = "star_particle", ExplosionSound = ContentPaths.Audio.wurp, HasTransitionTextures = false, EmitsLight = true }; CreateTransitionUVs(graphics, cubeTexture, 32, 32, new Point(0, 10), new Point(15, 10), new Point(15, 10), magicType.TransitionTextures); VoxelType scaffoldType = new VoxelType { Name = "Scaffold", StartingHealth = 20, ProbabilityOfRelease = 1.0f, ResourceToRelease = ResourceLibrary.ResourceType.Wood, ReleasesResource = false, CanRamp = false, RampSize = 0.5f, IsBuildable = true, ParticleType = "stone_particle" }; VoxelType grassType = new VoxelType { Name = "Grass", ProbabilityOfRelease = 0.1f, ResourceToRelease = ResourceLibrary.ResourceType.Dirt, StartingHealth = 10, ReleasesResource = true, CanRamp = true, RampSize = 0.5f, IsBuildable = false, ParticleType = "dirt_particle", HasTransitionTextures = true, IsSoil = true }; CreateTransitionUVs(graphics, cubeTexture, 32, 32, new Point(0, 3), new Point(2, 0), new Point(2, 0), grassType.TransitionTextures); VoxelType frostType = new VoxelType { Name = "Frost", ProbabilityOfRelease = 0.1f, ResourceToRelease = ResourceLibrary.ResourceType.Dirt, StartingHealth = 10, ReleasesResource = true, CanRamp = true, RampSize = 0.5f, IsBuildable = false, ParticleType = "dirt_particle", HasTransitionTextures = true }; CreateTransitionUVs(graphics, cubeTexture, 32, 32, new Point(0, 4), new Point(2, 0), new Point(2, 0), frostType.TransitionTextures); VoxelType desertGrass = new VoxelType { Name = "DesertGrass", ProbabilityOfRelease = 0.1f, ResourceToRelease = ResourceLibrary.ResourceType.Sand, StartingHealth = 10, ReleasesResource = true, CanRamp = true, RampSize = 0.5f, IsBuildable = false, ParticleType = "sand_particle", HasTransitionTextures = true }; CreateTransitionUVs(graphics, cubeTexture, 32, 32, new Point(0, 6), new Point(1, 1), new Point(1, 1), desertGrass.TransitionTextures); VoxelType jungleGrass = new VoxelType { Name = "JungleGrass", ProbabilityOfRelease = 0.1f, ResourceToRelease = ResourceLibrary.ResourceType.Dirt, StartingHealth = 10, ReleasesResource = true, CanRamp = true, RampSize = 0.5f, IsBuildable = false, ParticleType = "dirt_particle", HasTransitionTextures = true }; CreateTransitionUVs(graphics, cubeTexture, 32, 32, new Point(0, 5), new Point(2, 0), new Point(2, 0), jungleGrass.TransitionTextures); VoxelType dirtType = new VoxelType { Name = "Dirt", ReleasesResource = true, ResourceToRelease = ResourceLibrary.ResourceType.Dirt, ProbabilityOfRelease = 0.3f, StartingHealth = 10, RampSize = 0.5f, CanRamp = true, IsBuildable = true, ParticleType = "dirt_particle", IsSoil = true }; VoxelType stoneType = new VoxelType { Name = "Stone", ProbabilityOfRelease = 0.5f, ReleasesResource = true, ResourceToRelease = ResourceLibrary.ResourceType.Stone, StartingHealth = 30, IsBuildable = true, ParticleType = "stone_particle" }; VoxelType bedrockType = new VoxelType { Name = "Bedrock", StartingHealth = 255, IsBuildable = false, IsInvincible = true }; VoxelType waterType = new VoxelType { Name = "water", ReleasesResource = false, IsBuildable = false, StartingHealth = 255 }; VoxelType sandType = new VoxelType { Name = "Sand", ReleasesResource = false, StartingHealth = 5, CanRamp = true, RampSize = 0.5f, IsBuildable = false, ParticleType = "sand_particle" }; VoxelType ironType = new VoxelType { Name = "Iron", ProbabilityOfRelease = 0.99f, ReleasesResource = true, ResourceToRelease = ResourceLibrary.ResourceType.Iron, StartingHealth = 80, IsBuildable = false, ParticleType = "stone_particle" }; ResourceSpawns["Iron"] = new ResourceSpawnRate { VeinSize = 0.2f, VeinSpawnThreshold = 0.9f, MinimumHeight = -100, MaximumHeight = 100, Probability = 0.5f }; VoxelType coalType = new VoxelType { Name = "Coal", ProbabilityOfRelease = 0.99f, ReleasesResource = true, ResourceToRelease = ResourceLibrary.ResourceType.Coal, StartingHealth = 75, IsBuildable = false, ParticleType = "stone_particle" }; ResourceSpawns["Coal"] = new ResourceSpawnRate { VeinSize = 0.085f, VeinSpawnThreshold = 0.9f, MinimumHeight = -100, MaximumHeight = 100, Probability = 0.5f }; VoxelType goldType = new VoxelType { Name = "Gold", ProbabilityOfRelease = 1.0f, ReleasesResource = true, ResourceToRelease = ResourceLibrary.ResourceType.Gold, StartingHealth = 90, IsBuildable = false, ParticleType = "stone_particle" }; ResourceSpawns["Gold"] = new ResourceSpawnRate { VeinSize = 0.07f, VeinSpawnThreshold = 0.8f, MinimumHeight = -150, MaximumHeight = 15, Probability = 0.6f }; VoxelType manaType = new VoxelType { Name = "Mana", ProbabilityOfRelease = 1.0f, ReleasesResource = true, ResourceToRelease = ResourceLibrary.ResourceType.Mana, StartingHealth = 200, IsBuildable = false, ParticleType = "stone_particle" }; ResourceSpawns["Mana"] = new ResourceSpawnRate { VeinSize = 0.05f, VeinSpawnThreshold = 0.85f, MinimumHeight = -800, MaximumHeight = 8, Probability = 0.5f }; RegisterType(grassType, grassCube); RegisterType(frostType, frostCube); RegisterType(desertGrass, grassCube); RegisterType(jungleGrass, grassCube); RegisterType(emptyType, null); RegisterType(dirtType, dirtCube); RegisterType(stoneType, stoneCube); RegisterType(waterType, waterCube); RegisterType(sandType, sandCube); RegisterType(ironType, ironCube); RegisterType(goldType, goldCube); RegisterType(manaType, manaCube); RegisterType(plankType, plankCube); RegisterType(scaffoldType, scaffoldCube); RegisterType(bedrockType, bedrockCube); RegisterType(coalType, coalCube); RegisterType(magicType, magicCube); foreach (VoxelType type in VoxelType.TypeList) { Types[type.Name] = type; } }