updat core

This commit is contained in:
2024-10-23 18:46:37 +08:00
parent 4fc0810107
commit 9b4a121e5b
41 changed files with 37911 additions and 21 deletions

View File

@@ -0,0 +1,42 @@
using System;
using Framework.Audio;
using Framework.Timer;
using Sirenix.Utilities;
using UnityEngine;
namespace Game.Component
{
public class PropEffect : MonoBehaviour
{
[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.gameObject.SetActive (false);
});
}
private void OnDisable ()
{
this._timeHandler?.Kill ();
}
}
}