62 lines
1.8 KiB
C#
62 lines
1.8 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace Template_RuntimeInstance
|
|
{
|
|
public abstract class BaseAbility : ScriptableObject
|
|
{
|
|
public string abilityName;
|
|
public string description;
|
|
public Sprite icon;
|
|
public List<TargetTag> targettingTags = new List<TargetTag>();
|
|
public List<GameTag> tags = new List<GameTag>();
|
|
public List<BaseEffect> abilityEffects = new List<BaseEffect>();
|
|
public float castTime;
|
|
public float manaCost;
|
|
public float healthCost = 0;
|
|
public float classResourceCost = 0;
|
|
public float cooldown;
|
|
public bool castableWhileMoving;
|
|
public AbilityAnimationType animationType;
|
|
|
|
public abstract IAbilityProperties CreateProperties();
|
|
|
|
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 influencingStat in effect.influencingStats)
|
|
{
|
|
if (!tags.Contains(influencingStat.statTag))
|
|
{
|
|
tags.Add(influencingStat.statTag);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |