You've already forked taptap2024_GJ_chidouren
38 lines
987 B
C#
38 lines
987 B
C#
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 ();
|
|
}
|
|
}
|
|
} |