阶段性完成
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
using System.Collections.Generic;
|
||||
using Cielonos.MainGame.Characters;
|
||||
using Cielonos.UI;
|
||||
using Sirenix.OdinInspector;
|
||||
using SLSFramework.General;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Cielonos.MainGame.Inventory
|
||||
@@ -48,6 +50,7 @@ namespace Cielonos.MainGame.Inventory
|
||||
public void Update(float deltaTime)
|
||||
{
|
||||
currentCooldown -= deltaTime;
|
||||
currentCooldown = Mathf.Max(currentCooldown, 0f);
|
||||
}
|
||||
|
||||
public bool IsAvailable()
|
||||
@@ -56,17 +59,23 @@ namespace Cielonos.MainGame.Inventory
|
||||
bool energyAvailable = character.attributeSm["Energy"] >= data.energyCost;
|
||||
return cooldownAvailable && energyAvailable;
|
||||
}
|
||||
|
||||
public RuntimeFunctionUnit ResetCooldown()
|
||||
|
||||
public RuntimeFunctionUnit Execute()
|
||||
{
|
||||
currentCooldown = maxCooldown;
|
||||
ResetCooldown();
|
||||
ConsumeEnergy();
|
||||
return this;
|
||||
}
|
||||
|
||||
public RuntimeFunctionUnit ConsumeEnergy()
|
||||
private void ResetCooldown()
|
||||
{
|
||||
character.attributeSm["CurrentEnergy"] -= data.energyCost;
|
||||
return this;
|
||||
currentCooldown = maxCooldown;
|
||||
}
|
||||
|
||||
private void ConsumeEnergy()
|
||||
{
|
||||
character.attributeSm["Energy"] -= data.energyCost;
|
||||
character.eventSm.onUseEnergy.Invoke(character, data.energyCost);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user