You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
CrowdControl/Assets/Scripts/Samples/FastConfettiMaker.cs

35 lines
955 B
C#

1 month ago
using UnityEngine;
using System;
using System.Collections;
using System.Linq;
using D2D.Utilities;
using D2D;
using D2D.Gameplay;
using NaughtyAttributes;
using static D2D.Utilities.SettingsFacade;
using static D2D.Utilities.CommonLazyFacade;
using static D2D.Utilities.CommonGameplayFacade;
namespace D2D
{
public class FastConfettiMaker : SmartScript
{
[SerializeField] private PoolType vfx;
[Foldout("Numbers")] [SerializeField] private float _spawnDelay;
[Foldout("Numbers")] [SerializeField] private float _spawnRange;
private IEnumerator Start()
{
var poolHub = this.FindLazy<PoolHub>();
while (enabled)
{
var p = transform.position + DMath.RandomPointInsideBox(_spawnRange);
poolHub.Spawn(vfx, p);
yield return new WaitForSeconds(_spawnDelay);
}
}
}
}