Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
BlizzardSky.cs
Go to the documentation of this file.
1using System;
6
8
9public class BlizzardSky : CustomSky
10{
12
13 private bool _isActive;
14
15 private bool _isLeaving;
16
17 private float _opacity;
18
19 public override void OnLoad()
20 {
21 }
22
23 public override void Update(GameTime gameTime)
24 {
26 {
27 return;
28 }
29 if (_isLeaving)
30 {
31 _opacity -= (float)gameTime.ElapsedGameTime.TotalSeconds;
32 if (_opacity < 0f)
33 {
34 _isActive = false;
35 _opacity = 0f;
36 }
37 }
38 else
39 {
40 _opacity += (float)gameTime.ElapsedGameTime.TotalSeconds;
41 if (_opacity > 1f)
42 {
43 _opacity = 1f;
44 }
45 }
46 }
47
48 public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth)
49 {
50 if (minDepth < 1f || maxDepth == float.MaxValue)
51 {
52 float num = Math.Min(1f, Main.cloudAlpha * 2f);
53 Color color = new Color(new Vector4(1f) * Main.ColorOfTheSkies.ToVector4()) * _opacity * 0.7f * num;
54 spriteBatch.Draw(TextureAssets.MagicPixel.Value, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), color);
55 }
56 }
57
58 public override void Activate(Vector2 position, params object[] args)
59 {
60 _isActive = true;
61 _isLeaving = false;
62 }
63
64 public override void Deactivate(params object[] args)
65 {
66 _isLeaving = true;
67 }
68
69 public override void Reset()
70 {
71 _opacity = 0f;
72 _isActive = false;
73 }
74
75 public override bool IsActive()
76 {
77 return _isActive;
78 }
79}
void Draw(Texture2D texture, Vector2 position, Color color)
static byte Min(byte val1, byte val2)
Definition Math.cs:912
override void Update(GameTime gameTime)
override void Deactivate(params object[] args)
override void Activate(Vector2 position, params object[] args)
override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth)
static Asset< Texture2D > MagicPixel
static Microsoft.Xna.Framework.Color ColorOfTheSkies
Definition Main.cs:2577
static float cloudAlpha
Definition Main.cs:1302
static bool hasFocus
Definition Main.cs:1781
static int screenHeight
Definition Main.cs:1721
static int screenWidth
Definition Main.cs:1719
static bool gamePaused
Definition Main.cs:1072