Пример #1
0
        public override void PlaceInWorld(int i, int j, Item item)
        {
            Tile tile = Main.tile[i, j];

            tile.frameX = ManaCrystalShardTile.PickFrameX(i, j);
            tile.frameY = ManaCrystalShardTile.PickFrameY(i, j);
        }
Пример #2
0
        ////

        public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak)
        {
            Tile  tile   = Main.tile[i, j];
            short frameY = ManaCrystalShardTile.PickFrameY(i, j);

            if (tile.frameY != frameY)
            {
                if (frameY == -1)
                {
                    TileLibraries.KillTileSynced(i, j, false, true, true);
                }
                else
                {
                    tile.frameY = frameY;
                    resetFrame  = true;
                }
            }

            return(false);
        }
Пример #3
0
        ////

        public override bool PreDraw(int i, int j, SpriteBatch spriteBatch)
        {
            this.UpdateDrawnTileSlow(i, j);
            ManaCrystalShardTile.UpdateIlluminationAt(i, j);

            float illum;

            ManaCrystalShardTile.GetIlluminationAt(i, j, out illum);

            if (illum <= 0f)
            {
                return(false);
            }
            else if (illum >= 0.9f)
            {
                Dust.NewDust(
                    Position: new Vector2(i << 4, j << 4),
                    Width: 16,
                    Height: 16,
                    Type: 20,
                    SpeedX: 0f,
                    SpeedY: 0f,
                    Alpha: 0,
                    newColor: new Color(255, 255, 255),
                    Scale: 0.5f
                    );
            }

            SpriteEffects effects = SpriteEffects.None;

            this.SetSpriteEffects(i, j, ref effects);

            Tile      tile    = Main.tile[i, j];
            Texture2D texture = Main.tileTexture[this.Type];

            /*if (Main.canDrawColorTile(i, j)) {
             *      texture = Main.tileAltTexture[Type, (int)tile.color()];
             * }
             * else {
             *      texture = Main.tileTexture[Type];
             * }*/

            Vector2 zero = !Main.drawToScreen
                                ? new Vector2(Main.offScreenRange, Main.offScreenRange)
                                : Vector2.Zero;

            int   x     = (i << 4) - (int)Main.screenPosition.X;
            int   y     = (j << 4) - (int)Main.screenPosition.Y;
            Color color = Lighting.GetColor(i, j) * illum * 0.75f;

            if (tile.frameX >= texture.Width)
            {
                tile.frameX = ManaCrystalShardTile.PickFrameX(i, j);
            }
            if (tile.frameY >= texture.Height)
            {
                tile.frameY = ManaCrystalShardTile.PickFrameY(i, j);
            }

            spriteBatch.Draw(
                texture: texture,
                position: new Vector2(x, y) + zero,
                sourceRectangle: new Rectangle(tile.frameX, tile.frameY, 16, 16),
                color: color,
                rotation: 0f,
                origin: default(Vector2),
                scale: 1f,
                effects: effects,
                layerDepth: 0f
                );

            return(false);            // return false to stop vanilla draw.
        }
Пример #4
0
        ////////////////

        public override bool CanPlace(int i, int j)
        {
            int frameY = ManaCrystalShardTile.PickFrameY(i, j);

            return(frameY != -1);
        }