Ejemplo n.º 1
0
    public bool CheckHit(AIUnit attacker, AIHitUnit hitUnit)
    {
        if (AIMgr.IsAntiCamp(attacker, this) == false)
        {
            return(false);
        }
        bool          isHit    = false;
        AiClipHitData hitData  = hitUnit.mHitData;
        HitCheckBase  hitCheck = hitData.hitCheckData;

        switch (hitData.hitCheckData.shapeType)
        {
        case EHitCheckShape.Capsule:
        case EHitCheckShape.Cylinder:
        {
            if (MathTool.CheckCylinderHit(hitUnit.pos, hitData.hitCheckData.height, hitData.hitCheckData.radius, Controller))
            {
                isHit = true;
            }
            break;
        }

        case EHitCheckShape.Fan:
        {
            if (MathTool.CheckFanHit(hitUnit.pos, hitCheck.height, hitCheck.radius, hitCheck.angle, hitUnit.forwardDir, Controller))
            {
                isHit = true;
            }
            break;
        }
        }

        if (isHit)
        {
            OnGetHit();
        }

        return(isHit);
    }