Ejemplo n.º 1
0
    public void Attack(RoleBase target)
    {
        if (target == null)
        {
            //Debug.LogError(name+"攻击的目标为空");
            AfterAct();
            return;
        }

        //暴击初始
        isCrit = false;

        Vector3 orPosition = fightGoPosition;

        fightRole.transform.DOMove(GetTargetPosition(target), ConstConfig.moveSpeed).OnComplete(
            () =>
        {
            fightRole.transform.DOMove(orPosition, ConstConfig.moveSpeed).OnComplete(AfterAct);
            int mpValue = GetAddMp();

            //并判断是否暴击
            int hurtValue = GetAttackValue();        //获取输出伤害

            //打中没
            isAttackSuccess = target.BeAttack(hurtValue, this);

            if (isAttackSuccess)
            {
                AddMp(mpValue);     //内力增加
            }
            //AddMp(80);
            AfterAttack(target);
        }
            );
    }