更新
This commit is contained in:
34
Assets/Scripts/MainGame/Characters/Player/PlayerFunctions.cs
Normal file
34
Assets/Scripts/MainGame/Characters/Player/PlayerFunctions.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using Cielonos.UI;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Cielonos.MainGame.Characters
|
||||
{
|
||||
public partial class Player
|
||||
{
|
||||
private float deltaTime => selfTimeSm.DeltaTime;
|
||||
}
|
||||
|
||||
public partial class Player
|
||||
{
|
||||
private void Regeneration()
|
||||
{
|
||||
float healthRegenRate = attributeSm["HealthRegenRate"] * deltaTime;
|
||||
|
||||
if (healthRegenRate != 0)
|
||||
{
|
||||
attributeSm["Health"] += healthRegenRate;
|
||||
attributeSm["Health"] = Mathf.Min(attributeSm["Health"], attributeSm["MaximumHealth"]);
|
||||
PlayerCanvas.Instance.playerInfoUIArea.UpdateHealth(true);
|
||||
}
|
||||
|
||||
float energyRegenRate = attributeSm["EnergyRegenRate"] * deltaTime;
|
||||
|
||||
if (energyRegenRate != 0)
|
||||
{
|
||||
attributeSm["Energy"] += energyRegenRate;
|
||||
attributeSm["Energy"] = Mathf.Min(attributeSm["Energy"], attributeSm["MaximumEnergy"]);
|
||||
PlayerCanvas.Instance.playerInfoUIArea.UpdateEnergy(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user