Advertisement
Jiysea

SpritePool Usage

Jun 25th, 2022
964
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.09 KB | None | 0 0
  1. public void SpritePoolUse(String filePath, double startTime, double endTime, int particleCount, Color4 color)
  2.         {
  3.             using (OsbSpritePool spritePool = new OsbSpritePool(GetLayer("Particles"), filePath, OsbOrigin.Centre))
  4.             {
  5.                 for (int v = 0; v < particleCount; v++)
  6.                 {
  7.                     float spawnX = Random(-107, 747);
  8.                     float spawnY = Random(0, 480);
  9.                     float distanceX = Random(-500, 500);
  10.                     float distanceY = Random(-500, 500);
  11.                     float randScale = Random(0.1f, 0.2f);
  12.  
  13.                     var glow = spritePool.Get(startTime, endTime);
  14.                     glow.Additive(startTime, endTime);
  15.                     glow.Color(startTime, color);
  16.  
  17.                     glow.Scale(startTime, randScale);
  18.                     glow.Move(startTime, endTime, new Vector2(spawnX, spawnY), new Vector2(spawnX + distanceX, spawnY + distanceY));
  19.                     glow.Fade(startTime, 0.1);
  20.                     glow.Fade(endTime, 0);
  21.                 }
  22.             }
  23.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement