Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ Draw()

override void Terraria.GameContent.Skies.VortexSky.Draw ( SpriteBatch spriteBatch,
float minDepth,
float maxDepth )
inline

Definition at line 91 of file VortexSky.cs.

92 {
93 if (maxDepth >= float.MaxValue && minDepth < float.MaxValue)
94 {
95 spriteBatch.Draw(TextureAssets.BlackTile.Value, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Color.Black * _fadeOpacity);
96 spriteBatch.Draw(_bgTexture.Value, new Rectangle(0, Math.Max(0, (int)((Main.worldSurface * 16.0 - (double)Main.screenPosition.Y - 2400.0) * 0.10000000149011612)), Main.screenWidth, Main.screenHeight), Color.White * Math.Min(1f, (Main.screenPosition.Y - 800f) / 1000f) * _fadeOpacity);
97 Vector2 vector = new Vector2(Main.screenWidth >> 1, Main.screenHeight >> 1);
98 Vector2 vector2 = 0.01f * (new Vector2((float)Main.maxTilesX * 8f, (float)Main.worldSurface / 2f) - Main.screenPosition);
99 spriteBatch.Draw(_planetTexture.Value, vector + new Vector2(-200f, -200f) + vector2, null, Color.White * 0.9f * _fadeOpacity, 0f, new Vector2(_planetTexture.Width() >> 1, _planetTexture.Height() >> 1), 1f, SpriteEffects.None, 1f);
100 }
101 float num = Math.Min(1f, (Main.screenPosition.Y - 1000f) / 1000f);
102 Vector2 vector3 = Main.screenPosition + new Vector2(Main.screenWidth >> 1, Main.screenHeight >> 1);
103 Rectangle rectangle = new Rectangle(-1000, -1000, 4000, 4000);
104 for (int i = 0; i < _bolts.Length; i++)
105 {
106 if (!_bolts[i].IsAlive || !(_bolts[i].Depth > minDepth) || !(_bolts[i].Depth < maxDepth))
107 {
108 continue;
109 }
110 Vector2 vector4 = new Vector2(1f / _bolts[i].Depth, 0.9f / _bolts[i].Depth);
111 Vector2 position = (_bolts[i].Position - vector3) * vector4 + vector3 - Main.screenPosition;
112 if (rectangle.Contains((int)position.X, (int)position.Y))
113 {
115 int life = _bolts[i].Life;
116 if (life > 26 && life % 2 == 0)
117 {
119 }
120 float num2 = (float)life / 30f;
121 spriteBatch.Draw(value, position, null, Color.White * num * num2 * _fadeOpacity, 0f, Vector2.Zero, vector4.X * 5f, SpriteEffects.None, 0f);
122 }
123 }
124 }
void Draw(Texture2D texture, Vector2 position, Color color)
static byte Min(byte val1, byte val2)
Definition Math.cs:912
static byte Max(byte val1, byte val2)
Definition Math.cs:738
Asset< Texture2D > _planetTexture
Definition VortexSky.cs:25
bool Contains(int x, int y)
Definition Rectangle.cs:92

References Terraria.GameContent.Skies.VortexSky._bgTexture, Terraria.GameContent.Skies.VortexSky._bolts, Terraria.GameContent.Skies.VortexSky._boltTexture, Terraria.GameContent.Skies.VortexSky._fadeOpacity, Terraria.GameContent.Skies.VortexSky._flashTexture, Terraria.GameContent.Skies.VortexSky._planetTexture, Microsoft.Xna.Framework.Color.Black, Terraria.GameContent.TextureAssets.BlackTile, Microsoft.Xna.Framework.Rectangle.Contains(), Microsoft.Xna.Framework.Graphics.Depth, Microsoft.Xna.Framework.Graphics.SpriteBatch.Draw(), Terraria.GameContent.Skies.VortexSky.Bolt.Life, System.Math.Max(), Terraria.Main.maxTilesX, System.Math.Min(), Terraria.GameContent.Skies.VortexSky.Bolt.Position, Terraria.Main.screenHeight, Terraria.Main.screenPosition, Terraria.Main.screenWidth, ReLogic.Content.Asset< T >.Value, System.value, Microsoft.Xna.Framework.Graphics.Vector2, Microsoft.Xna.Framework.Color.White, Terraria.Main.worldSurface, Microsoft.Xna.Framework.Vector2.X, Microsoft.Xna.Framework.Vector2.Y, and Microsoft.Xna.Framework.Vector2.Zero.