You've already forked taptap2024_GJ_chidouren
updat core
This commit is contained in:
@@ -6,19 +6,25 @@ using UnityEngine;
|
||||
|
||||
public class AttackTimer : MonoBehaviour
|
||||
{
|
||||
[SerializeField, Header ("追逐时长")] private float AttackRealTime;
|
||||
private TimeHandler _timeHandler;
|
||||
[SerializeField , Header ("准备时间")] private float AttackBeforeTime = 1.5f;
|
||||
[SerializeField, Header ("追逐时长")] private float AttackRealTime;
|
||||
private TimeHandler _atkReadyTimeHandler;
|
||||
private TimeHandler _timeHandler;
|
||||
|
||||
[ProgressBar(0 , "Curprogress")]
|
||||
public float Curprogress => this._timeHandler?.CurProgress ?? 0;
|
||||
[ProgressBar (0 , "Curprogress")] public float Curprogress => this._timeHandler?.CurProgress ?? 0;
|
||||
|
||||
public bool IsRunning => this._timeHandler?.IsPlaying ?? false;
|
||||
|
||||
|
||||
|
||||
|
||||
public void StartAttack (Action callback)
|
||||
{
|
||||
this._timeHandler?.Kill ();
|
||||
this._timeHandler = GameUpdateMgr.Instance.CreateTimer (this.AttackRealTime , callback);
|
||||
this._timeHandler = null;
|
||||
_atkReadyTimeHandler?.Kill ();
|
||||
this._atkReadyTimeHandler = GameUpdateMgr.Instance.CreateTimer (this.AttackBeforeTime , () =>
|
||||
{
|
||||
this._timeHandler = GameUpdateMgr.Instance.CreateTimer (this.AttackRealTime , callback);
|
||||
});
|
||||
}
|
||||
|
||||
public void StopAttack ()
|
||||
|
||||
42
Assets/Scripts/Game/Component/PropEffect.cs
Normal file
42
Assets/Scripts/Game/Component/PropEffect.cs
Normal 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 ();
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/Game/Component/PropEffect.cs.meta
Normal file
3
Assets/Scripts/Game/Component/PropEffect.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dad6a6e7f3d94023ab1c253e83631e1e
|
||||
timeCreated: 1729671366
|
||||
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 ();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 61c36d0ce3914b4b9943971f9e028269
|
||||
timeCreated: 1729675170
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
using Framework.GamePool.manager;
|
||||
using Framework.Timer;
|
||||
using Sirenix.Utilities;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Game.Component.SceneProp
|
||||
@@ -9,10 +11,12 @@ namespace Game.Component.SceneProp
|
||||
/// </summary>
|
||||
public class BaseProp : MonoBehaviour
|
||||
{
|
||||
[SerializeField, Header ("触发特效")] private string effectPoolPath;
|
||||
|
||||
// 间隔cd
|
||||
[SerializeField , Header ("间隔cd")] private float _invalidTime = 0f;
|
||||
[SerializeField , Header ("间隔cd")] private float _invalidTime = 0f;
|
||||
[SerializeField] protected bool HasOnce = true;
|
||||
private TimeHandler _timeHandler;
|
||||
private TimeHandler _timeHandler;
|
||||
protected bool isReady => this._timeHandler == null || this._timeHandler.IsDone;
|
||||
|
||||
public void ResetProp ()
|
||||
@@ -28,6 +32,13 @@ namespace Game.Component.SceneProp
|
||||
if (isReady)
|
||||
{
|
||||
var entity = other.gameObject.GetComponent<PlayerEntity> ();
|
||||
if (!this.effectPoolPath.IsNullOrWhitespace ())
|
||||
{
|
||||
var transform1 = this.transform;
|
||||
GamePoolManager.Instance.InstantiatePoolObject<PropEffect_PoolObject> (this.effectPoolPath).transform.position
|
||||
= transform1.position;
|
||||
}
|
||||
|
||||
this.OnTrigger (entity);
|
||||
if (HasOnce)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user