24 lines
663 B
C#
24 lines
663 B
C#
using UnityEngine;
|
|
|
|
public class SwordSlash : Ability
|
|
{
|
|
public LayerMask entityLayer;
|
|
//probably will change out entity detection. or will i?
|
|
//i'd also probably have to offset the damage origin direction
|
|
public float damageRadius;
|
|
protected override void AbilityEffects()
|
|
{
|
|
base.AbilityEffects();
|
|
Collider2D[] entitiesFound = Physics2D.OverlapCircleAll(thisEntity.attackOriginPoint.position, damageRadius, entityLayer);
|
|
foreach (Collider2D entityFound in entitiesFound)
|
|
{
|
|
if (!entityFound.CompareTag(thisEntity.tag))
|
|
{
|
|
if (entityFound.TryGetComponent(out Entity isEntity))
|
|
{
|
|
isEntity.stats.TakeDamage(power);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|