maybe before cycling import
failsafe
This commit is contained in:
parent
299091b632
commit
e94e2b8dce
3 changed files with 18 additions and 3 deletions
|
@ -1,10 +1,11 @@
|
|||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
|
||||
public class BaseCapacity : MonoBehaviour
|
||||
{
|
||||
[field: SerializeField] public float MaxMana { get; private set; }
|
||||
[field: SerializeField] public float Mana { get; private set; }
|
||||
protected float ManaCost;
|
||||
[SerializeField] private float manaCost;
|
||||
protected AbstractUnit _unit;
|
||||
|
||||
|
||||
|
@ -30,10 +31,10 @@ public class BaseCapacity : MonoBehaviour
|
|||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (Mana >= ManaCost)
|
||||
if (Mana >= manaCost)
|
||||
{
|
||||
bool capacityLaunched = CapacityCall();
|
||||
if (capacityLaunched) Mana -= ManaCost;
|
||||
if (capacityLaunched) Mana -= manaCost;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
12
Assets/Scripts/UnitScripts/Capacities/WitchSummon.cs
Normal file
12
Assets/Scripts/UnitScripts/Capacities/WitchSummon.cs
Normal file
|
@ -0,0 +1,12 @@
|
|||
using UnityEngine;
|
||||
|
||||
public class WitchSummon : BaseCapacity
|
||||
{
|
||||
[SerializeField] private GameObject summonUnit;
|
||||
|
||||
protected override bool CapacityCall()
|
||||
{
|
||||
Instantiate(summonUnit, transform.position, Quaternion.identity);
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1c3c6b3848aa5f3cd9b73630ddae811e
|
Loading…
Add table
Add a link
Reference in a new issue