From 32bb4364d6f90d1088d5fe3a811762b2c574e049 Mon Sep 17 00:00:00 2001 From: spatialfree Date: Sun, 24 Nov 2024 13:17:45 -0500 Subject: [PATCH] particle pool --- src/VFX.cs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/VFX.cs b/src/VFX.cs index ef89ded..3940850 100644 --- a/src/VFX.cs +++ b/src/VFX.cs @@ -5,7 +5,25 @@ namespace snake; static class VFX { - + public static Particle[] particles = new Particle[32]; + static int index = 0; + + public static void Init() + { + for (int i = 0; i < particles.Length; i++) + { + particles[i] = new(); + } + } + + public static void Play(XYZi pos) + { + for (int i = 0; i < 8; i++) + { + index = (index + 1) % particles.Length; + } + } + } public class Particle