BrainCoral - PostDraw as PreDraw
This commit is contained in:
1 parent
cac4e86bb7
commit
dc34edc051
1 file changed
+13
-8
@@ -29,25 +29,30 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient
|
||||
{
|
||||
num = fail ? 1 : 3;
|
||||
}
|
||||
public override void PostDraw(int i, int j, SpriteBatch spriteBatch)
|
||||
|
||||
public override bool PreDraw(int i, int j, SpriteBatch spriteBatch)
|
||||
{
|
||||
var tile = Main.tile[i, j];
|
||||
if (tile.IsTileActuallyInvisible())
|
||||
return false;
|
||||
|
||||
float glowbrightness = 1f;
|
||||
if (Main.tile[i, j].IsTileActuallyInvisible())
|
||||
return;
|
||||
float glowspeed = (float)(Main.timeForVisualEffects * 0.01);
|
||||
glowbrightness *= MathF.Sin(i / 60f + glowspeed);
|
||||
|
||||
int xFrameOffset = Main.tile[i, j].TileFrameX;
|
||||
int yFrameOffset = Main.tile[i, j].TileFrameY;
|
||||
int xFrameOffset = tile.TileFrameX;
|
||||
int yFrameOffset = tile.TileFrameY;
|
||||
Texture2D glowmask = TextureAssets.Tile[Type].Value;
|
||||
Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange);
|
||||
Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest;
|
||||
Color drawColour = Color.White * glowbrightness;
|
||||
Tile trackTile = Main.tile[i, j];
|
||||
if (!trackTile.IsHalfBlock && trackTile.Slope == 0)
|
||||
|
||||
if (!tile.IsHalfBlock && tile.Slope == 0)
|
||||
spriteBatch.Draw(glowmask, drawPosition, new Rectangle(xFrameOffset, yFrameOffset, 18, 18), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f);
|
||||
else if (trackTile.IsHalfBlock)
|
||||
else if (tile.IsHalfBlock)
|
||||
spriteBatch.Draw(glowmask, drawPosition + new Vector2(0f, 8f), new Rectangle(xFrameOffset, yFrameOffset, 18, 8), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void NearbyEffects(int i, int j, bool closer)
|
||||
|
||||
Reference in new issue
Block a user