You've already forked taptap2024_GJ_chidouren
updat core
This commit is contained in:
38
Assets/Scripts/Game/Component/PropEffect_PoolObject.cs
Normal file
38
Assets/Scripts/Game/Component/PropEffect_PoolObject.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using Framework.Audio;
|
||||
using Framework.GamePool;
|
||||
using Framework.Timer;
|
||||
using Sirenix.Utilities;
|
||||
|
||||
namespace Game.Component
|
||||
{
|
||||
public class PropEffect_PoolObject : NonePoolObject
|
||||
{
|
||||
[Serializable]
|
||||
public class AudioSetting
|
||||
{
|
||||
public string audioPath;
|
||||
public float volume = 1;
|
||||
}
|
||||
|
||||
public AudioSetting audioSetting;
|
||||
public float duration;
|
||||
|
||||
private TimeHandler _timeHandler;
|
||||
|
||||
private void OnEnable ()
|
||||
{
|
||||
this._timeHandler?.Kill ();
|
||||
if (!this.audioSetting.audioPath.IsNullOrWhitespace ())
|
||||
{
|
||||
AudioManager.Instance.PlaySound (this.audioSetting.audioPath , this.audioSetting.volume);
|
||||
}
|
||||
this._timeHandler = GameUpdateMgr.Instance.CreateTimer (this.duration , this.DestroyPoolObject);
|
||||
}
|
||||
|
||||
private void OnDisable ()
|
||||
{
|
||||
this._timeHandler?.Kill ();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user