/// <summary> /// Plays the specified fx at the specified position repeatedly with the given interval. /// </summary> /// <param name="position">The position to play at.</param> /// <param name="fxName">The fx to play.</param> /// <param name="interval">The delay between plays in seconds.</param> /// <param name="initialDelay">Specifies an initial delay in seconds before playing the fx for the first time.</param> /// <returns></returns> public static RepeatedFx PlayFx(Vector3 position, string fxName, float interval, bool playAtSpawn = true) { var fx = new RepeatedFx(fxName, position, interval); if (playAtSpawn) { PlayFx(fx.Position, fx.FxName); } RepeatingFx.Add(fx.Id, fx); return(fx); }
/// <summary> /// Stops playing the repeating fx. /// </summary> /// <param name="fx">The fx to stop repeating.</param> public static void StopFx(RepeatedFx fx) { fx.Timer.DestroyToPool(); fx.Timer = null; RepeatingFx.Remove(fx.Id); }