1
This commit is contained in:
40
Packages/Runtime/Components/EffectPlayer.cs
Normal file
40
Packages/Runtime/Components/EffectPlayer.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
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;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user