using UnityEngine;
using Gamelogic.Grids2;

public class ApplyDamage : MonoBehaviour {
    public int Amount = 1;

    void ApplyEffect(MessageParamPair<GridPoint2, GridPoint2> param)
    {
        GridPoint2 impact = param.Value1;
        GridPoint2 direction = param.Value2;

        Damage(impact, direction);
    }

    private void Damage(GridPoint2 pos, GridPoint2 dir)
    {
        if (!GameMap.Cell[pos].HasActor())
            return;

        ((Actor)GameMap.Cell[pos].Actor).TakeDamage(Amount);
    }
}
