整理武器配置和重构

This commit is contained in:
2026-09-15 10:13:58 +08:00
parent 17ee268416
commit 421f8bf619
115 changed files with 1431 additions and 1905 deletions
@@ -1,4 +1,5 @@
using SepCore.Entity;
using SepCore.Timer;
using GameFramework;
using UnityEngine;
using UnityGameFramework.Runtime;
@@ -9,6 +10,11 @@ namespace SepCore.Entity
{
[SerializeField] private EntityDataBase _entityData = null;
protected bool _canAttack;
protected TimerHandle _attackTimerHandle;
public bool CanAttack => _canAttack;
public int Id => Entity.Id;
public Animation CachedAnimation { get; private set; }
@@ -47,6 +53,26 @@ namespace SepCore.Entity
base.OnHide(isShutdown, userData);
}
protected void StartAttackCooldown(float cooldown)
{
_canAttack = false;
_attackTimerHandle = GameEntry.Timer.ScheduleOnce(cooldown, () => _canAttack = true, this);
}
public void ResetAttackCooldown(float cooldown)
{
GameEntry.Timer.Cancel(_attackTimerHandle);
_canAttack = false;
_attackTimerHandle = GameEntry.Timer.ScheduleOnce(cooldown, () => _canAttack = true, this);
}
protected void CancelAttackCooldown()
{
GameEntry.Timer.Cancel(_attackTimerHandle);
_attackTimerHandle = TimerHandle.Invalid;
_canAttack = false;
}
protected override void OnAttached(EntityLogic childEntity, Transform parentTransform, object userData)
{
base.OnAttached(childEntity, parentTransform, userData);