public static SurfaceInfoObject GetSurfaceInfoFor(GameObject obj, Vector3 worldPos) { SurfaceInfo component = obj.GetComponent <SurfaceInfo>(); if (component != null) { return(component.SurfaceObj(worldPos)); } IDBase base2 = obj.GetComponent <IDBase>(); if (base2 != null) { SurfaceInfo info2 = base2.idMain.GetComponent <SurfaceInfo>(); if (info2 != null) { return(info2.SurfaceObj(worldPos)); } } return(SurfaceInfoObject.GetDefault()); }
public static SurfaceInfoObject GetSurfaceInfoFor(GameObject obj, Vector3 worldPos) { SurfaceInfo component = obj.GetComponent <SurfaceInfo>(); if (component) { return(component.SurfaceObj(worldPos)); } IDBase dBase = obj.GetComponent <IDBase>(); if (dBase) { SurfaceInfo surfaceInfo = dBase.idMain.GetComponent <SurfaceInfo>(); if (surfaceInfo) { return(surfaceInfo.SurfaceObj(worldPos)); } } return(SurfaceInfoObject.GetDefault()); }