Capacity + Health and Mana bars

This commit is contained in:
Crizomb 2025-01-21 12:59:14 +01:00
parent b21d392ff6
commit 7d3b4ced0e
41 changed files with 1739 additions and 32 deletions

View file

@ -0,0 +1,33 @@
using UnityEngine;
using System.Collections;
public class GolemDefense : BaseCapacity
{
[SerializeField] private float armorGain;
[SerializeField] private float buffTime;
[SerializeField] private SphereCollider buffArea;
protected override bool CapacityCall()
{
Collider[] hitColliders = Physics.OverlapSphere(transform.position, buffArea.radius, buffArea.includeLayers);
foreach (Collider target in hitColliders)
{
if (!target.CompareTag("Unit")) continue;
AbstractUnit targetUnit = target.GetComponent<AbstractUnit>();
if (targetUnit.IsTeamA == _unit.IsTeamA)
{
CoroutineManager.Instance.StartCoroutine(AddThenRemoveArmor(targetUnit));
}
}
return hitColliders.Length > 0;
}
private IEnumerator AddThenRemoveArmor(AbstractUnit targetUnit)
{
targetUnit.AddArmor(armorGain);
yield return new WaitForSeconds(buffTime);
targetUnit.RemoveArmor(armorGain);
}
}