You've already forked taptap2024_GJ_chidouren
完成4种基础ai
This commit is contained in:
33
Assets/Scripts/Game/Component/FsmMonoData/AttackTimer.cs
Normal file
33
Assets/Scripts/Game/Component/FsmMonoData/AttackTimer.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using Framework.Timer;
|
||||
using Sirenix.OdinInspector;
|
||||
using UnityEngine;
|
||||
|
||||
public class AttackTimer : MonoBehaviour
|
||||
{
|
||||
[SerializeField, Header ("追逐时长")] private float AttackRealTime;
|
||||
private TimeHandler _timeHandler;
|
||||
|
||||
[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);
|
||||
}
|
||||
|
||||
public void StopAttack ()
|
||||
{
|
||||
this._timeHandler?.Kill ();
|
||||
this._timeHandler = null;
|
||||
}
|
||||
|
||||
private void OnDisable ()
|
||||
{
|
||||
StopAttack ();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user