Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
ScreenObstruction.cs
Go to the documentation of this file.
3
5
6public class ScreenObstruction
7{
8 public static float screenObstruction;
9
10 public static void Update()
11 {
12 float value = 0f;
13 float amount = 0.1f;
14 if (Main.player[Main.myPlayer].headcovered)
15 {
16 value = 0.95f;
17 amount = 0.3f;
18 }
20 }
21
22 public static void Draw(SpriteBatch spriteBatch)
23 {
24 if (screenObstruction != 0f)
25 {
26 Color color = Color.Black * screenObstruction;
27 int num = TextureAssets.Extra[49].Width();
28 int num2 = 10;
29 Rectangle rect = Main.player[Main.myPlayer].getRect();
30 rect.Inflate((num - rect.Width) / 2, (num - rect.Height) / 2 + num2 / 2);
31 rect.Offset(-(int)Main.screenPosition.X, -(int)Main.screenPosition.Y + (int)Main.player[Main.myPlayer].gfxOffY - num2);
32 Rectangle destinationRectangle = Rectangle.Union(new Rectangle(0, 0, 1, 1), new Rectangle(rect.Right - 1, rect.Top - 1, 1, 1));
33 Rectangle destinationRectangle2 = Rectangle.Union(new Rectangle(Main.screenWidth - 1, 0, 1, 1), new Rectangle(rect.Right, rect.Bottom - 1, 1, 1));
34 Rectangle destinationRectangle3 = Rectangle.Union(new Rectangle(Main.screenWidth - 1, Main.screenHeight - 1, 1, 1), new Rectangle(rect.Left, rect.Bottom, 1, 1));
35 Rectangle destinationRectangle4 = Rectangle.Union(new Rectangle(0, Main.screenHeight - 1, 1, 1), new Rectangle(rect.Left - 1, rect.Top, 1, 1));
36 spriteBatch.Draw(TextureAssets.MagicPixel.Value, destinationRectangle, new Rectangle(0, 0, 1, 1), color);
37 spriteBatch.Draw(TextureAssets.MagicPixel.Value, destinationRectangle2, new Rectangle(0, 0, 1, 1), color);
38 spriteBatch.Draw(TextureAssets.MagicPixel.Value, destinationRectangle3, new Rectangle(0, 0, 1, 1), color);
39 spriteBatch.Draw(TextureAssets.MagicPixel.Value, destinationRectangle4, new Rectangle(0, 0, 1, 1), color);
40 spriteBatch.Draw(TextureAssets.Extra[49].Value, rect, color);
41 }
42 }
43}
void Draw(Texture2D texture, Vector2 position, Color color)
static float Lerp(float value1, float value2, float amount)
Definition MathHelper.cs:53
static void Draw(SpriteBatch spriteBatch)
static Asset< Texture2D >[] Extra
static Asset< Texture2D > MagicPixel
static int myPlayer
Definition Main.cs:1801
static int screenHeight
Definition Main.cs:1721
static Vector2 screenPosition
Definition Main.cs:1715
static int screenWidth
Definition Main.cs:1719
static Player[] player
Definition Main.cs:1803
void Inflate(int horizontalAmount, int verticalAmount)
Definition Rectangle.cs:84
static Rectangle Union(Rectangle value1, Rectangle value2)
Definition Rectangle.cs:197