Esempio n. 1
0
 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);
 }
Esempio n. 2
0
 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;
 }
Esempio n. 3
0
 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;
 }
Esempio n. 4
0
 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);
 }
Esempio n. 5
0
        /// <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);
        }