示例#1
0
    private IEnumerator LateAtk(Character _target, float delay, Skill skill)
    {
        skill.cast(this.character, _target);
        yield return(new WaitForSeconds(delay));

        AbstractAI targetAI = _target.ai;

        if (this.IsDied() || targetAI.IsDied() || !isInAttackArea(_target.gameObject, getAtkRange()))
        {
            yield break;
        }

        bool isCrit  = IsCrit(skill, _target);
        bool isDodge = IsDodge(skill, _target);
        int  damage  = GetDamage(atkTarget, skill, isCrit, isDodge);

        _target.hp -= damage;
        Vector3 attackdir = this.transform.position - _target.gameObject.transform.position;

        attackdir[1] = 0f;
        attackdir    = Vector3.Normalize(attackdir);
        if (_target.type == CharacterType.MONSTER && isCrit && !isDodge)
        {
            cameraCtrl.Hitcam();
        }
        targetAI.OnHit(damage, attackdir, character, isCrit, isDodge);
    }