Esempio n. 1
0
        void UpdateCompassBarElement(HUDNavigationElement element, Vector3 screenPos, float distance)
        {
            // check if element is hidden within the compass bar
            if (element.hideInCompassBar)
            {
                element.SetMarkerActive(NavigationElementType.CompassBar, false);
                return;
            }

            // check distance
            if (distance > compassBarRadius && !element.ignoreCompassBarRadius)
            {
                element.SetMarkerActive(NavigationElementType.CompassBar, false);

                // invoke events
                if (element.IsInCompassBarRadius)
                {
                    element.IsInCompassBarRadius = false;
                    element.OnLeaveRadius.Invoke(element, NavigationElementType.CompassBar);
                }
                return;
            }

            // invoke events
            if (!element.IsInCompassBarRadius)
            {
                element.IsInCompassBarRadius = true;
                element.OnEnterRadius.Invoke(element, NavigationElementType.CompassBar);
            }

            // set marker position
            if (screenPos.z <= 0)
            {
                // hide marker and skip element
                element.SetMarkerActive(NavigationElementType.CompassBar, false);
                return;
            }

            // show compass bar distance?
            element.ShowCompassBarDistance((int)distance);

            // set marker active
            element.SetMarkerActive(NavigationElementType.CompassBar, true);

            // set marker position
            element.SetMarkerPosition(NavigationElementType.CompassBar, screenPos, _HUDNavigationCanvas.CompassBar.ElementContainer);
        }