/*--------------------------------------------------------------------------------------------*/ public SegmentSettings GetSegmentSettings(NavItem pNavItem) { InitOnce(); HovercastCustomSegment seg = FindCustom(vMainSeg, pNavItem, (c => c.Seg)); return(seg.GetSettings()); }
//////////////////////////////////////////////////////////////////////////////////////////////// /*--------------------------------------------------------------------------------------------*/ private void InitOnce() { if (vMainSeg != null) { return; } vMainSeg = gameObject.GetComponent <HovercastCustomSegment>(); vMainPalm = gameObject.GetComponent <HovercastCustomPalm>(); vCursor = gameObject.GetComponent <HovercastCustomCursor>(); vInteract = gameObject.GetComponent <HovercastCustomInteraction>(); if (vMainSeg == null) { Debug.LogWarning("Hovercast | No '" + typeof(HovercastCustomSegment).Name + "' provided; using default."); vMainSeg = gameObject.AddComponent <HovercastDefaultSegment>(); } if (vMainPalm == null) { Debug.LogWarning("Hovercast | No '" + typeof(HovercastCustomPalm).Name + "' provided; using default."); vMainPalm = gameObject.AddComponent <HovercastDefaultPalm>(); } if (vCursor == null) { Debug.LogWarning("Hovercast | No '" + typeof(HovercastCustomCursor).Name + "' provided; using default."); vCursor = gameObject.AddComponent <HovercastDefaultCursor>(); } if (vInteract == null) { Debug.LogWarning("Hovercast | No '" + typeof(HovercastCustomInteraction).Name + "' provided; using default."); vInteract = gameObject.AddComponent <HovercastCustomInteraction>(); } //// vCustomMap = new Dictionary <int, CustomItem>(); HovercastCustomSegment[] segList = gameObject.GetComponentsInChildren <HovercastCustomSegment>(); HovercastCustomPalm[] palmList = gameObject.GetComponentsInChildren <HovercastCustomPalm>(); FillCustomItems(segList, ((c, s) => { c.Seg = s; })); FillCustomItems(palmList, ((c, p) => { c.Palm = p; })); }
//////////////////////////////////////////////////////////////////////////////////////////////// /*--------------------------------------------------------------------------------------------*/ public Type GetSegmentRenderer(NavItem pNavItem) { if (pNavItem == null) { throw new ArgumentException("Hovercast | NavItem cannot be null.", "NavItem"); } InitOnce(); HovercastCustomSegment seg = FindCustom(vMainSeg, pNavItem, (c => c.Seg)); return(seg.GetRendererForNavItemType(pNavItem.Type)); }