2026-01-03 18:19:39 -05:00
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
namespace Cielonos.MainGame.Characters
|
|
|
|
|
{
|
|
|
|
|
public partial class Player
|
|
|
|
|
{
|
|
|
|
|
private float deltaTime => selfTimeSm.DeltaTime;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public partial class Player
|
|
|
|
|
{
|
|
|
|
|
private void Regeneration()
|
|
|
|
|
{
|
2026-05-23 08:27:50 -04:00
|
|
|
float healthRegenRate = attributeSm[CharacterAttribute.HealthRegeneration] * deltaTime;
|
2026-01-03 18:19:39 -05:00
|
|
|
|
|
|
|
|
if (healthRegenRate != 0)
|
|
|
|
|
{
|
2026-06-27 12:52:03 -04:00
|
|
|
Heal(healthRegenRate, false);
|
2026-01-03 18:19:39 -05:00
|
|
|
}
|
|
|
|
|
|
2026-05-23 08:27:50 -04:00
|
|
|
float energyRegenRate = attributeSm[CharacterAttribute.EnergyRegeneration] * deltaTime;
|
2026-01-03 18:19:39 -05:00
|
|
|
if (energyRegenRate != 0)
|
|
|
|
|
{
|
2026-06-27 12:52:03 -04:00
|
|
|
RecoverEnergy(energyRegenRate, false);
|
2026-04-18 13:57:19 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void DistributeOverloadEnergy(float totalOverflowAmount)
|
|
|
|
|
{
|
|
|
|
|
if (totalOverflowAmount <= 0) return;
|
|
|
|
|
|
|
|
|
|
var overloadSubmodules = new System.Collections.Generic.List<Inventory.OverloadSubmodule>();
|
|
|
|
|
|
|
|
|
|
if (inventorySc.equipmentSm.currentMainWeapon?.overloadSm != null)
|
|
|
|
|
{
|
|
|
|
|
overloadSubmodules.Add(inventorySc.equipmentSm.currentMainWeapon.overloadSm);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach (var equip in inventorySc.equipmentSm.currentSupportEquipments)
|
|
|
|
|
{
|
|
|
|
|
if (equip?.overloadSm != null)
|
|
|
|
|
{
|
|
|
|
|
overloadSubmodules.Add(equip.overloadSm);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-10 11:47:55 -04:00
|
|
|
foreach (var equip in inventorySc.backpackSm.passiveEquipments)
|
2026-04-18 13:57:19 -04:00
|
|
|
{
|
|
|
|
|
if (equip?.overloadSm != null)
|
|
|
|
|
{
|
|
|
|
|
overloadSubmodules.Add(equip.overloadSm);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (overloadSubmodules.Count == 0) return;
|
|
|
|
|
|
|
|
|
|
float totalWeight = 0;
|
|
|
|
|
foreach (var sm in overloadSubmodules)
|
|
|
|
|
{
|
|
|
|
|
totalWeight += sm.currentWeight;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (totalWeight <= 0) return;
|
|
|
|
|
|
|
|
|
|
foreach (var sm in overloadSubmodules)
|
|
|
|
|
{
|
|
|
|
|
float assignedAmount = totalOverflowAmount * (sm.currentWeight / totalWeight);
|
|
|
|
|
sm.ReceiveEnergy(assignedAmount);
|
2026-01-03 18:19:39 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|