예제 #1
0
    protected IEnumerator Hit(BoardCreator board, UnitStats target, Tile source)
    {
        if (data.Damage > 0)
        {
            target.TakeDamage(unit.GetComponent <UnitStats>().GetAttack(board, data));
        }
        if (data.Heal > 0)
        {
            target.Heal(data.Heal);
        }

        if (!target.IsDead())
        {
            if (data.hasKnockback && target.GetComponent <Unit>().KnockbackAble())
            {
                Point direction = source.pos - target.GetComponent <Unit>().tile.pos;
                yield return(StartCoroutine(target.ApplyKnockback(board, direction)));
            }

            if (data.status != StatusEffects.NONE)
            {
                target.AddStatus(data.status);
            }
        }
    }