- 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
80 lines
2.3 KiB
C#
80 lines
2.3 KiB
C#
using Photon.Pun;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
//[CreateAssetMenu(fileName = "BaseAbility", menuName = "RiftMayhem/AbilitySystem/Abilities/Base Ability", order = 1)]
|
|
public class BaseAbility : ScriptableObject
|
|
{
|
|
public Sprite Icon;
|
|
public List<TargetTag> targettingTags = new List<TargetTag>();
|
|
public List<GameTag> tags = new List<GameTag>();
|
|
public List<BaseEffect> abilityEffects = new List<BaseEffect>();
|
|
[Space]
|
|
public float castTime;
|
|
public float manaCost;
|
|
public float healthCost = 0;
|
|
public float cooldown;
|
|
public bool castableWhileMoving;
|
|
public AbilityAnimationType animationType;
|
|
|
|
public virtual void Execute(PhotonView user, Taggable userTag)
|
|
{
|
|
user.GetComponent<Mana>().ChangeValue(-manaCost);
|
|
user.GetComponent<Health>().ChangeValue(-healthCost);
|
|
|
|
//for (int i = 0; i < abilityEffects.Count; i++)
|
|
//{
|
|
// Debug.Log($"Ability {this.name} applied {abilityEffects[i].name} effect at xtarget");
|
|
//}
|
|
}
|
|
public virtual void Execute(PhotonView user, Taggable userTag, Vector3 point)
|
|
{
|
|
user.GetComponent<Mana>().ChangeValue(-manaCost);
|
|
user.GetComponent<Health>().ChangeValue(-healthCost);
|
|
}
|
|
|
|
public virtual void Execute(PhotonView user, Taggable userTag, Transform target)
|
|
{
|
|
user.GetComponent<Mana>().ChangeValue(-manaCost);
|
|
user.GetComponent<Health>().ChangeValue(-healthCost);
|
|
}
|
|
|
|
private void OnValidate()
|
|
{
|
|
InitializeUniqueTags();
|
|
}
|
|
|
|
private void OnEnable()
|
|
{
|
|
InitializeUniqueTags();
|
|
}
|
|
|
|
public void InitializeUniqueTags()
|
|
{
|
|
tags.Clear();
|
|
|
|
// Iterate through each effect and add unique GameTags to uniqueTags list
|
|
foreach (var effect in abilityEffects)
|
|
{
|
|
if (effect != null)
|
|
{
|
|
foreach (var tag in effect.tags)
|
|
{
|
|
if (!tags.Contains(tag))
|
|
{
|
|
tags.Add(tag);
|
|
}
|
|
}
|
|
foreach (var statTag in effect.influencingStats)
|
|
{
|
|
if(!tags.Contains(statTag))
|
|
{
|
|
tags.Add(statTag);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|