1
Fork 0
slime-blood-and-pain/Assets/Scripts/PlayerAttackMelee.cs

20 lines
582 B
C#
Raw Normal View History

2019-04-28 14:28:31 +00:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
2019-04-28 14:34:50 +00:00
public class PlayerAttackMelee : PlayerAttack
2019-04-28 14:28:31 +00:00
{
public float damage = 1f;
2019-04-29 17:53:45 +00:00
public GameObject attackAnimation;
2019-04-28 14:28:31 +00:00
public override bool Attack(Vector2Int target) {
List<Entity> targetEntities = turnHandler.GetEntitiesAtPosition(target);
if(targetEntities.Count == 0) {
return false;
}
Entity targetEntity = targetEntities[0];
targetEntity.hp -= damage;
2019-04-29 17:53:45 +00:00
Instantiate(attackAnimation, targetEntity.transform);
2019-04-28 14:28:31 +00:00
return true;
}
}