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

◆ Draw()

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

Definition at line 162 of file SlimeSky.cs.

163 {
164 if (Main.screenPosition.Y > 10000f || Main.gameMenu)
165 {
166 return;
167 }
168 int num = -1;
169 int num2 = 0;
170 for (int i = 0; i < _slimes.Length; i++)
171 {
172 float depth = _slimes[i].Depth;
173 if (num == -1 && depth < maxDepth)
174 {
175 num = i;
176 }
177 if (depth <= minDepth)
178 {
179 break;
180 }
181 num2 = i;
182 }
183 if (num == -1)
184 {
185 return;
186 }
187 Vector2 vector = Main.screenPosition + new Vector2(Main.screenWidth >> 1, Main.screenHeight >> 1);
188 Rectangle rectangle = new Rectangle(-1000, -1000, 4000, 4000);
189 for (int j = num; j < num2; j++)
190 {
191 if (_slimes[j].Active)
192 {
193 Color color = new Color(Main.ColorOfTheSkies.ToVector4() * 0.9f + new Vector4(0.1f)) * 0.8f;
194 float num3 = 1f;
195 if (_slimes[j].Depth > 3f)
196 {
197 num3 = 0.6f;
198 }
199 else if ((double)_slimes[j].Depth > 2.5)
200 {
201 num3 = 0.7f;
202 }
203 else if (_slimes[j].Depth > 2f)
204 {
205 num3 = 0.8f;
206 }
207 else if ((double)_slimes[j].Depth > 1.5)
208 {
209 num3 = 0.9f;
210 }
211 num3 *= 0.8f;
212 color = new Color((int)((float)(int)color.R * num3), (int)((float)(int)color.G * num3), (int)((float)(int)color.B * num3), (int)((float)(int)color.A * num3));
213 Vector2 vector2 = new Vector2(1f / _slimes[j].Depth, 0.9f / _slimes[j].Depth);
214 Vector2 position = _slimes[j].Position;
215 position = (position - vector) * vector2 + vector - Main.screenPosition;
216 position.X = (position.X + 500f) % 4000f;
217 if (position.X < 0f)
218 {
219 position.X += 4000f;
220 }
221 position.X -= 500f;
222 if (rectangle.Contains((int)position.X, (int)position.Y))
223 {
224 spriteBatch.Draw(_slimes[j].Texture, position, _slimes[j].GetSourceRectangle(), color, 0f, Vector2.Zero, vector2.X * 2f, SpriteEffects.None, 0f);
225 }
226 }
227 }
228 }
void Draw(Texture2D texture, Vector2 position, Color color)
bool Contains(int x, int y)
Definition Rectangle.cs:92

References Terraria.GameContent.Skies.SlimeSky._slimes, Microsoft.Xna.Framework.Color.A, Terraria.Graphics.Effects.Active, Microsoft.Xna.Framework.Color.B, Microsoft.Xna.Framework.Graphics.Color, Terraria.Main.ColorOfTheSkies, Microsoft.Xna.Framework.Rectangle.Contains(), Microsoft.Xna.Framework.Graphics.Depth, Terraria.GameContent.Skies.SlimeSky.Slime.Depth, Microsoft.Xna.Framework.Graphics.SpriteBatch.Draw(), Microsoft.Xna.Framework.Color.G, Terraria.Main.gameMenu, Terraria.GameContent.Skies.SlimeSky.Slime.Position, Microsoft.Xna.Framework.Color.R, Terraria.Main.screenHeight, Terraria.Main.screenPosition, Terraria.Main.screenWidth, Microsoft.Xna.Framework.Graphics.Vector2, Microsoft.Xna.Framework.Vector2.X, Microsoft.Xna.Framework.Vector2.Y, and Microsoft.Xna.Framework.Vector2.Zero.