Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
RandomizedFrameParticle.cs
Go to the documentation of this file.
3
5
7{
8 public float FadeInNormalizedTime;
9
10 public float FadeOutNormalizedTime = 1f;
11
13
15
17
18 private float _timeTolive;
19
20 private float _timeSinceSpawn;
21
22 private int _gameFramesCounted;
23
24 public override void FetchFromPool()
25 {
26 base.FetchFromPool();
32 _timeTolive = 0f;
33 _timeSinceSpawn = 0f;
35 }
36
37 public void SetTypeInfo(int animationFramesAmount, int gameFramesPerAnimationFrame, float timeToLive)
38 {
39 _timeTolive = timeToLive;
40 GameFramesPerAnimationFrame = gameFramesPerAnimationFrame;
41 AnimationFramesAmount = animationFramesAmount;
43 }
44
45 private void RandomizeFrame()
46 {
48 _origin = _frame.Size() / 2f;
49 }
50
51 public override void Update(ref ParticleRendererSettings settings)
52 {
53 base.Update(ref settings);
54 _timeSinceSpawn += 1f;
56 {
57 base.ShouldBeRemovedFromRenderer = true;
58 }
60 {
63 }
64 }
65
66 public override void Draw(ref ParticleRendererSettings settings, SpriteBatch spritebatch)
67 {
69 spritebatch.Draw(_texture.Value, settings.AnchorPosition + LocalPosition, _frame, color, Rotation, _origin, Scale, SpriteEffects.None, 0f);
70 }
71}
void Draw(Texture2D texture, Vector2 position, Color color)
override void Draw(ref ParticleRendererSettings settings, SpriteBatch spritebatch)
override void Update(ref ParticleRendererSettings settings)
void SetTypeInfo(int animationFramesAmount, int gameFramesPerAnimationFrame, float timeToLive)
static UnifiedRandom rand
Definition Main.cs:1387
static float GetLerpValue(float from, float to, float t, bool clamped=false)
Definition Utils.cs:203