增加重装填触发型buff

main
刘涛 2023-10-31 19:33:19 +08:00
parent 1a6115df49
commit 40e28ee343
3 changed files with 36 additions and 0 deletions

View File

@ -28,6 +28,7 @@ namespace Gameplay.Buff
}
}
private bool _needRemove;
public bool needRemove
{
get
@ -40,6 +41,8 @@ namespace Gameplay.Buff
return runtimeData.passTime >= configData.MaxExistTime;
case EExistType.Allways:
return false;
case EExistType.AfterReload:
return _needRemove;
default:
DebugUtil.LogError("暂未处理的buff existType:{0}",configData.ExistType);
return true;
@ -148,9 +151,28 @@ namespace Gameplay.Buff
_remainTriggerTime += configData.TiggerUnitTime;
}
}
_OnLogicUpdate(dt);
}
public void TriggerOnReload()
{
if (configData.TriggerType == ETriggerType.ON_RELOAD)
{
_OnTrigger();
}
if (configData.ExistType == EExistType.AfterReload)
{
_needRemove = true;
}
_OnReload();
}
protected virtual void _OnReload()
{
}
protected virtual void _OnLogicUpdate(float dt)
{
@ -169,6 +191,7 @@ namespace Gameplay.Buff
}
public void OnReturn()
{
_needRemove = false;
}
protected float _TryGetFloatParam(int index)

View File

@ -206,5 +206,15 @@ namespace Gameplay.Buff
}
public void TriggerReload()
{
for (int i = 0; i < totalBuffList.Count; i++)
{
var buff = totalBuffList[i];
if (buff.needRemove) continue;
buff.TriggerOnReload();
}
}
}
}

View File

@ -32,6 +32,9 @@ namespace Gameplay.Character
_lastInLowMorale = owner.runtimeData.isInSuppressed;
var reloadTime = owner.fightData.reloadTime;
_reloadTime = reloadTime;
// 触发reload
owner.buffManager.TriggerReload();
owner.runtimeData.isReloading = true;
}