- NPC controller reworked completely - ability priority list for npc's - npc's with animations - damage over time effect added - burn, poison and bleed over time effects added
53 lines
1.8 KiB
C#
53 lines
1.8 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
[System.Serializable]
|
|
public class AbilityConditionManager
|
|
{
|
|
public BaseAbility ability;
|
|
public List<AbilityCastCondition> castConditions = new List<AbilityCastCondition>();
|
|
|
|
|
|
public bool CanCastAbility(NPCControllerBase npc)
|
|
{
|
|
foreach (AbilityCastCondition condition in castConditions)
|
|
{
|
|
switch (condition.conditionType)
|
|
{
|
|
case AbilityCastConditionType.Mana:
|
|
{
|
|
if (npc.Mana.EnoughMana(ability.manaCost))
|
|
continue;
|
|
else return false;
|
|
}
|
|
case AbilityCastConditionType.Health:
|
|
{
|
|
if (npc.Health.EnoughHealth(ability.manaCost))
|
|
continue;
|
|
else return false;
|
|
}
|
|
case AbilityCastConditionType.MeleeDistance:
|
|
{
|
|
if (npc.IsCloseEnough(npc.currentTarget.transform.position, npc.MeleeRange))
|
|
continue;
|
|
else return false;
|
|
}
|
|
case AbilityCastConditionType.RangedDistance:
|
|
{
|
|
if (npc.IsCloseEnough(npc.currentTarget.transform.position, npc.ProjectileRange))
|
|
continue;
|
|
else return false;
|
|
}
|
|
case AbilityCastConditionType.Cooldown:
|
|
{
|
|
if (!npc.abilityCooldownTracker.OnCooldown(ability))
|
|
continue;
|
|
else return false;
|
|
}
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
}
|