the worlds WORST code
This commit is contained in:
parent
99cda5f6b9
commit
c2a71d5188
6 changed files with 731 additions and 8 deletions
|
|
@ -4,6 +4,7 @@ public class EnemyAbility : ScriptableObject
|
|||
{
|
||||
public float cooldown;
|
||||
public float power;
|
||||
public float range;
|
||||
public virtual void UseAbility(Entity target, Enemy owner)
|
||||
{
|
||||
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ public class Enemy : Entity
|
|||
Ability foundAbility = null;
|
||||
foreach (Ability availableAbility in allAbilities)
|
||||
{
|
||||
if (foundAbility == null && availableAbility.currentCooldown <= 0)
|
||||
if (foundAbility == null && availableAbility.currentCooldown <= 0 && availableAbility.ability.range < Vector3.Distance(closestTarget.transform.position, transform.position))
|
||||
{
|
||||
foundAbility = availableAbility;
|
||||
}
|
||||
|
|
|
|||
10
Assets/Scripts/Entities/Enemy/EnemyMelee.cs
Normal file
10
Assets/Scripts/Entities/Enemy/EnemyMelee.cs
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
using UnityEngine;
|
||||
|
||||
[CreateAssetMenu(fileName = "New Enemy Melee Ability", menuName = "EnemyAbilities/Melee")]
|
||||
public class EnemyMelee : EnemyAbility
|
||||
{
|
||||
public override void UseAbility(Entity target, Enemy owner)
|
||||
{
|
||||
target.TakeDamage(power, owner);
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Entities/Enemy/EnemyMelee.cs.meta
Normal file
2
Assets/Scripts/Entities/Enemy/EnemyMelee.cs.meta
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 5766cdfd69614633494a3b73de96271a
|
||||
|
|
@ -11,4 +11,9 @@ public class UIHandler : MonoBehaviour
|
|||
{
|
||||
hiddenUI.SetActive(false);
|
||||
}
|
||||
|
||||
public void ToggleUI(GameObject toggledUI)
|
||||
{
|
||||
toggledUI.SetActive(!toggledUI.activeSelf);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue