예제 #1
0
    // We're just doing straight damage here
    public override void DealEffects(Unit target, Unit source)
    {
        if (target != null)
        {
            //deal core damage to central target
            target.ChangeHealth((GetDamage() * (-1)), source, this);
        }
        Vector2Int origin = source.GetMapPosition();

        origin += MapMath.DirToRelativeLoc(source.GetDirection());
        List <Vector2Int> area = AttackHelper.GetCircleAOE(origin, source.GetDirection(), GetRange());

        //skip first one(center)
        for (int i = 0; i < area.Count; i++)
        {
            if (area[i] == source.GetMapPosition())
            {
                continue;
            }
            Unit searchResult = source.globalPositionalData.SearchLocation(area[i]);
            if (searchResult != null)
            {
                searchResult.ChangeHealth((GetDamage() * -1) / 3, source, this);
                Vector2Int diff = searchResult.GetMapPosition() - origin;
                // AttackHelper.DisplaceUnit(searchResult, source, this, 1, MapMath.LocToDirection(diff));
            }
        }
        source.ChangeHealth((GetDamage() * (-1)), source, this);
    }