more abilities and fixes
This commit is contained in:
parent
cb4470f2d6
commit
fc2329a873
31 changed files with 268 additions and 52 deletions
24
Assets/Scripts/Abilities/SwordSlash.cs
Normal file
24
Assets/Scripts/Abilities/SwordSlash.cs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
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.stats.attackOriginPoint.position, damageRadius, entityLayer);
|
||||
foreach (Collider2D entityFound in entitiesFound)
|
||||
{
|
||||
if (!entityFound.CompareTag(thisEntity.tag))
|
||||
{
|
||||
if (entityFound.TryGetComponent(out Entity isEntity))
|
||||
{
|
||||
isEntity.stats.TakeDamage(power);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue