Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
CreditsRollSky.cs
Go to the documentation of this file.
7
9
11{
12 private int _endTime;
13
14 private int _currentTime;
15
17
19
21
22 private bool _isActive;
23
24 private bool _wantsToBeSeen;
25
26 private float _opacity;
27
29
31 {
33 }
34
35 public override void Update(GameTime gameTime)
36 {
38 {
39 return;
40 }
42 float num = 1f / 120f;
43 if (Main.gameMenu)
44 {
45 num = 1f / 15f;
46 }
47 _opacity = MathHelper.Clamp(_opacity + num * (float)_wantsToBeSeen.ToDirectionInt(), 0f, 1f);
48 if (_opacity == 0f && !_wantsToBeSeen)
49 {
50 _isActive = false;
51 return;
52 }
53 bool flag = true;
55 {
56 flag = false;
57 }
59 {
60 flag = false;
61 }
62 if (!flag)
63 {
64 SkyManager.Instance.Deactivate("CreditsRoll");
65 }
66 }
67
68 public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth)
69 {
70 float num = 1f;
71 if (!(num < minDepth) && !(num > maxDepth))
72 {
74 if (Main.gameMenu)
75 {
76 anchorPositionOnScreen.Y = 300f;
77 }
79 gameAnimationSegment.SpriteBatch = spriteBatch;
80 gameAnimationSegment.AnchorPositionOnScreen = anchorPositionOnScreen;
81 gameAnimationSegment.TimeInAnimation = _currentTime;
82 gameAnimationSegment.DisplayOpacity = _opacity;
85 if (Main.gameMenu)
86 {
88 }
89 for (int i = 0; i < list.Count; i++)
90 {
91 list[i].Draw(ref info);
92 }
93 }
94 }
95
96 public override bool IsActive()
97 {
98 return _isActive;
99 }
100
101 public override void Reset()
102 {
103 _currentTime = 0;
105 _isActive = false;
106 _wantsToBeSeen = false;
107 }
108
109 public override void Activate(Vector2 position, params object[] args)
110 {
111 _isActive = true;
112 _wantsToBeSeen = true;
113 if (_opacity == 0f)
114 {
116 _currentTime = 0;
117 }
118 }
119
130
131 public override void Deactivate(params object[] args)
132 {
133 _wantsToBeSeen = false;
134 }
135}
static float Clamp(float value, float min, float max)
Definition MathHelper.cs:46
override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth)
override void Activate(Vector2 position, params object[] args)
override void Update(GameTime gameTime)
override void Deactivate(params object[] args)
List< IAnimationSegment > _segmentsInMainMenu
List< IAnimationSegment > _segmentsInGame
void FillSegments(List< IAnimationSegment > segmentsList, out int endTime, bool inGame)
static bool CanPlayCreditsRoll()
Definition Main.cs:2978
static bool hasFocus
Definition Main.cs:1781
static Microsoft.Xna.Framework.Point ScreenSize
Definition Main.cs:2925
static bool gameMenu
Definition Main.cs:1926
static bool gamePaused
Definition Main.cs:1072