public Cobblestone(TextureAtlas textureAtlas) : base(textureAtlas, new Vector2(0, 1), "Cobblestone", 35) { this.destroyTimesWithTools.Add("WoodenPickaxe", 30); this.destroyTimesWithTools.Add("StonePickaxe", 20); this.destroyTimesWithTools.Add("IronPickaxe", 10); }
public CoalOre(TextureAtlas textureAtlas) : base(textureAtlas, new Vector2(2, 2), "CoalOre") { this.drop = new InventoryStack(new Items.Coal(null), 1); this.destroyTimesWithTools.Add("WoodenPickaxe", 30); this.destroyTimesWithTools.Add("StonePickaxe", 20); this.destroyTimesWithTools.Add("IronPickaxe", 10); }
public Block(TextureAtlas textureAtlas, Vector2 texPos, string name) { this.texPos = texPos; this.textureFromAtlas = textureAtlas.getTexture(texPos); this.textureFromAtlas.GetData<Color>(this.textureColorData); this.name = name; this.destroyTimesWithTools.Add("Null", 40); }
public Item(TextureAtlas textureAtlas, Vector2 texPos, string name) { this.texPos = texPos; if (textureAtlas != null) { this.textureFromAtlas = textureAtlas.getTexture(texPos); this.textureFromAtlas.GetData<Color>(this.textureColorData); } this.name = name; }
public Block(TextureAtlas textureAtlas, Vector2 texPos, string name, int destroyingTime) { this.texPos = texPos; this.textureFromAtlas = textureAtlas.getTexture(texPos); this.textureFromAtlas.GetData<Color>(this.textureColorData); this.name = name; if (destroyingTime > 0) this.destroyTimesWithTools.Add("Null", destroyingTime); else this.canDestroy = false; }
private static void GenerateOres(World world, TextureAtlas textureAtlas, int x, int y, int stoneY, int seed) { for (int i = y + stoneY - 7; i < 4 + y + stoneY + 1; i++) { Random rand1 = new Random(seed + x + y + stoneY + i); Random rand2 = new Random(seed + x + y + stoneY + i + 1); if (rand1.Next(16) == 0) { int oreLength = rand2.Next(2, 6); for (int i_ = x; i_ <= x + oreLength; i_++) { Blocks.CoalOre coalore_ = new Blocks.CoalOre(textureAtlas); world.SetBlockWithReplace(new Vector2(i_, 16 - i + 10), coalore_); } } Random rand3 = new Random(seed + x + y + stoneY + i + 2); Random rand4 = new Random(seed + x + y + stoneY + i + 3); if (rand3.Next(28) == 0) { int oreLength = rand4.Next(3, 6); for (int i_ = x; i_ <= x + oreLength; i_++) { Blocks.IronOre ironore_ = new Blocks.IronOre(textureAtlas); world.SetBlockWithReplace(new Vector2(i_, 16 - i + 12), ironore_); } } Random rand5 = new Random(seed + x + y + stoneY + i + 4); Random rand6 = new Random(seed + x + y + stoneY + i + 5); if (rand5.Next(40) == 0) { int oreLength = rand6.Next(2, 5); for (int i_ = x; i_ <= x + oreLength; i_++) { Blocks.GoldOre goldore_ = new Blocks.GoldOre(textureAtlas); world.SetBlockWithReplace(new Vector2(i_, 16 - i + 16), goldore_); } } } }
public static void Generate(Mine2D game, TextureAtlas textureAtlas, World world, int seed) { LibNoise.Perlin noise = new LibNoise.Perlin(); noise.Seed = seed; List<int> maxTreesY = new List<int>(); for (int x = -256; x < 256; x++) { double Y = noise.GetValue((float)x / 17F, 1, 1) * 4; int y = (int)Y; maxTreesY.Add(16 - y - 16); Blocks.Grass grass = new Blocks.Grass(textureAtlas); world.SetBlock(new Vector2(x, 16 - y), grass); int dirtY = new Random(seed + x + y).Next(2, 5); int stoneY = y - new Random(seed + x + y + 1).Next(5, 8) + (3 - dirtY); for (int i = y - dirtY; i < y; i++) { Blocks.Dirt dirt_ = new Blocks.Dirt(textureAtlas); world.SetBlock(new Vector2(x, 16 - i), dirt_); } for (int i = -24; i < 4 + y + (4 - dirtY) + 1; i++) { Blocks.Stone stone_ = new Blocks.Stone(textureAtlas); world.SetBlock(new Vector2(x, 16 - i + 9), stone_); } for (int i = y + stoneY - 7; i < 4 + y + stoneY + 1; i++) { Blocks.Cobblestone cobblestone_ = new Blocks.Cobblestone(textureAtlas); world.SetBlockWithReplace(new Vector2(x, 16 - i + 10), cobblestone_); } GenerateOres(world, textureAtlas, x, y, stoneY, seed); Blocks.Bedrock bedrock_ = new Blocks.Bedrock(textureAtlas); world.SetBlock(new Vector2(x, 50), bedrock_); } GenerateTrees(-256, 256, maxTreesY.ToArray(), seed, world, textureAtlas); game.gameState = GameState.Playing; }
public Workbench(TextureAtlas textureAtlas, Block block) : base(textureAtlas, block.texPos, "Workbench", block.destroyTimesWithTools["Null"]) { if (block.name != "Workbench") throw new ArgumentException(); }
public Coal(TextureAtlas textureAtlas) : base(textureAtlas, new Vector2(7, 0), "Coal") { }
public IronPickaxe(TextureAtlas textureAtlas) : base(textureAtlas, new Vector2(2, 6), "IronPickaxe") { }
public Workbench(TextureAtlas textureAtlas) : base(textureAtlas, new Vector2(11, 3), "Workbench", 25) { }
/// <summary> /// LoadContent будет вызываться в игре один раз; здесь загружается /// весь контент. /// </summary> protected override void LoadContent() { // Создайте новый SpriteBatch, который можно использовать для отрисовки текстур. spriteBatch = new SpriteBatch(GraphicsDevice); Texture2D blocksAtlasTex = Content.Load<Texture2D>("Textures/blocks"); blocksAtlas = new TextureAtlas(GraphicsDevice, blocksAtlasTex); Texture2D itemsAtlasTex = Content.Load<Texture2D>("Textures/items"); itemsAtlas = new TextureAtlas(GraphicsDevice, itemsAtlasTex); for (int i = 0; i < 10; i++) { destroyTextures[i] = blocksAtlas.getTexture(new Vector2(i, 15)); } font = Content.Load<SpriteFont>("font"); button = Content.Load<Texture2D>("Textures/Button"); buttonActive = Content.Load<Texture2D>("Textures/ButtonActive"); logo = Content.Load<Texture2D>("Textures/Logo"); textbox = Content.Load<Texture2D>("Textures/Textbox"); smallInventoryTex = Content.Load<Texture2D>("Textures/SmallInventory"); normalInventoryTex = Content.Load<Texture2D>("Textures/NormalInventory"); workbenchInventoryTex = Content.Load<Texture2D>("Textures/WorkbenchInventory"); furnaceInventoryTex = Content.Load<Texture2D>("Textures/FurnaceInventory"); durabilityBarEmpty = Content.Load<Texture2D>("Textures/DurabilityBarEmpty"); durabilityBarFull = Content.Load<Texture2D>("Textures/DurabilityBarFull"); SoundManager.Initialize(Content); player = new Player(ref camera, Content); }
public void FinishLoadAfterDeserialization(TextureAtlas textureAtlas) { this.textureColorData = new Color[TextureAtlas.TEXTURE_SIZE * TextureAtlas.TEXTURE_SIZE]; this.textureFromAtlas = textureAtlas.getTexture(texPos); this.textureFromAtlas.GetData<Color>(this.textureColorData); }
public Grass(TextureAtlas textureAtlas) : base(textureAtlas, new Vector2(3, 0), "Grass", 20) { }
public Furnace(TextureAtlas textureAtlas) : base(textureAtlas, new Vector2(12, 2), "Furnace", 35) { }
public Glass(TextureAtlas textureAtlas) : base(textureAtlas, new Vector2(4, 3), "Glass", 10) { }
public Bedrock(TextureAtlas textureAtlas) : base(textureAtlas, new Vector2(1, 1), "Bedrock", -1) { }
public WoodenPickaxe(TextureAtlas textureAtlas) : base(textureAtlas, new Vector2(0, 6), "WoodenPickaxe") { }
public StonePickaxe(TextureAtlas textureAtlas) : base(textureAtlas, new Vector2(1, 6), "StonePickaxe") { }
public Stick(TextureAtlas textureAtlas) : base(textureAtlas, new Vector2(5, 3), "Stick") { }
public object Clone(TextureAtlas textureAtlas) { Block block = new Block(textureAtlas, this.texPos, this.name, this.destroyTimesWithTools["Null"]); block.destroyTimesWithTools = this.destroyTimesWithTools; return block; }
public GoldIngot(TextureAtlas textureAtlas) : base(textureAtlas, new Vector2(7, 2), "GoldIngot") { }
public Dirt(TextureAtlas textureAtlas) : base(textureAtlas, new Vector2(2, 0), "Dirt", 20) { }
public Leaves(TextureAtlas textureAtlas) : base(textureAtlas, new Vector2(4, 3), "Leaves", 10) { }
public Furnace(TextureAtlas textureAtlas, Block block) : base(textureAtlas, block.texPos, "Furnace", block.destroyTimesWithTools["Null"]) { if (block.name != "Furnace") throw new ArgumentException(); this.destroyTimesWithTools.Add("WoodenPickaxe", 30); this.destroyTimesWithTools.Add("StonePickaxe", 20); this.destroyTimesWithTools.Add("IronPickaxe", 10); }
public Planks(TextureAtlas textureAtlas) : base(textureAtlas, new Vector2(4, 0), "Planks", 25) { }
public object Clone(TextureAtlas textureAtlas) { Item item = new Item(textureAtlas, this.texPos, this.name); item.damage = this.damage; return item; }
public Wood(TextureAtlas textureAtlas) : base(textureAtlas, new Vector2(4, 1), "Wood", 25) { }
public IronOre(TextureAtlas textureAtlas) : base(textureAtlas, new Vector2(1, 2), "IronOre", 50) { this.destroyTimesWithTools.Add("WoodenPickaxe", 40); this.destroyTimesWithTools.Add("StonePickaxe", 30); this.destroyTimesWithTools.Add("IronPickaxe", 20); }
public IronIngot(TextureAtlas textureAtlas) : base(textureAtlas, new Vector2(7, 1), "IronIngot") { }