2024-10-23 18:46:37 +08:00
|
|
|
|
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;
|
|
|
|
|
|
|
2024-10-27 21:13:14 +08:00
|
|
|
|
public override void Pool_Enable ()
|
2024-10-23 18:46:37 +08:00
|
|
|
|
{
|
|
|
|
|
|
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);
|
2024-10-27 21:13:14 +08:00
|
|
|
|
base.Pool_Enable ();
|
2024-10-23 18:46:37 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-10-27 21:13:14 +08:00
|
|
|
|
public void Pool_OnDisable ()
|
2024-10-23 18:46:37 +08:00
|
|
|
|
{
|
|
|
|
|
|
this._timeHandler?.Kill ();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|