Exemple #1
0
    public static Hardpoint GetHardpointFromRay(Ray ray, Hardpoint.hardpoint_type type)
    {
        RaycastHit        raycastHit;
        bool              flag;
        MeshBatchInstance meshBatchInstance;

        if (Facepunch.MeshBatch.MeshBatchPhysics.Raycast(ray, out raycastHit, 10f, out flag, out meshBatchInstance))
        {
            IDMain dMain = (!flag ? IDBase.GetMain(raycastHit.collider) : meshBatchInstance.idMain);
            if (dMain)
            {
                HardpointMaster component = dMain.GetComponent <HardpointMaster>();
                if (component)
                {
                    return(component.GetHardpointNear(raycastHit.point, type));
                }
            }
        }
        return(null);
    }
Exemple #2
0
    public static Hardpoint GetHardpointFromRay(Ray ray, hardpoint_type type)
    {
        RaycastHit        hit;
        bool              flag;
        MeshBatchInstance instance;

        if (Facepunch.MeshBatch.MeshBatchPhysics.Raycast(ray, out hit, 10f, out flag, out instance))
        {
            IDMain main = !flag?IDBase.GetMain(hit.collider) : instance.idMain;

            if (main != null)
            {
                HardpointMaster component = main.GetComponent <HardpointMaster>();
                if (component != null)
                {
                    return(component.GetHardpointNear(hit.point, type));
                }
            }
        }
        return(null);
    }