40 lines
1.1 KiB
C#
40 lines
1.1 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using Cysharp.Threading.Tasks;
|
|
namespace BITKit
|
|
{
|
|
public class EffectPlayer : MonoBehaviour
|
|
{
|
|
[Header(Constant.Header.Settings)]
|
|
[SerializeField] float duration;
|
|
[Header(Constant.Header.Components)]
|
|
[SerializeField] ParticleSystem[] particleSystems;
|
|
[SerializeField] Behaviour[] behaviours;
|
|
void Start()
|
|
{
|
|
particleSystems.ForEach(x => x.Stop());
|
|
behaviours.ForEach(x => x.enabled = false);
|
|
}
|
|
public async void Excute()
|
|
{
|
|
particleSystems.ForEach(x =>
|
|
{
|
|
x.time = 0;
|
|
x.Play(true);
|
|
});
|
|
behaviours.ForEach(x =>
|
|
{
|
|
x.enabled = true;
|
|
});
|
|
await UniTask.Delay(System.TimeSpan.FromSeconds(duration));
|
|
if (BehaviourHelper.Actived)
|
|
{
|
|
behaviours.ForEach(x =>
|
|
{
|
|
x.enabled = false;
|
|
});
|
|
}
|
|
}
|
|
}
|
|
} |