Example #1
0
        public override void RightClick(int i, int j)
        {
            Player   player = Main.LocalPlayer;
            DBTWorld world  = ModContent.GetInstance <DBTWorld>();

            if (!world.repairedGravModule)
            {
                if (player.HasItem(ModContent.ItemType <RefinedMetal>()))
                {
                    world.repairedGravModule = true;
                    Main.NewText("Gravity Generator Repaired!");
                    CircularDust(i, j, 20, 31, 10, 1);
                }
                else
                {
                    Main.NewText("You do not have enough refined metal to fix this machine!");
                }
            }
            else
            {
                if (!_activated)
                {
                    _activated = true;
                }
                else if (_activated)
                {
                    _activated = false;
                }
            }
        }
Example #2
0
        public override bool PreDraw(int i, int j, SpriteBatch spriteBatch)
        {
            Tile      tile = Main.tile[i, j];
            Texture2D texture;
            DBTWorld  world = ModContent.GetInstance <DBTWorld>();

            if (world.repairedGravModule)
            {
                if (_activated)
                {
                    texture = mod.GetTexture("Tiles/ActiveRepairedGravityGenerator");
                }
                else
                {
                    texture = mod.GetTexture("Tiles/RepairedGravityGenerator");
                }
            }
            else
            {
                texture = Main.tileTexture[Type];
            }

            Vector2 zero = new Vector2(Main.offScreenRange, Main.offScreenRange);

            if (Main.drawToScreen)
            {
                zero = Vector2.Zero;
            }

            Main.spriteBatch.Draw(texture, new Vector2(i * 16 - (int)Main.screenPosition.X, j * 16 - (int)Main.screenPosition.Y + 2) + zero, new Rectangle(tile.frameX, tile.frameY, 162, 200), Lighting.GetColor(i, j), 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
            return(false);
        }