Beispiel #1
0
        /// <summary>
        /// Creates a label for a building.
        /// </summary>
        /// <param name="buildingGameObject">The GameObject of the building.</param>
        /// <param name="placeId">The place ID of the building.</param>
        /// <param name="displayName">The name to display on the label for the building.</param>
        void CreateLabel(GameObject buildingGameObject, string placeId, string displayName)
        {
            if (Random.value > Ratio)
            {
                return;
            }

            if (!Labeller.enabled)
            {
                return;
            }

            // Ignore uninteresting names.
            if (displayName.Equals("ExtrudedStructure") || displayName.Equals("ModeledStructure"))
            {
                return;
            }

            Label label = Labeller.NameObject(buildingGameObject, placeId, displayName);

            if (label != null)
            {
                MapsGamingExamplesUtils.PlaceUIMarker(buildingGameObject, label.transform);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Positions and shows the arrow object used to highlight a specific map feature.
        /// The target feature is passed as an input.
        /// </summary>
        private void ShowPointer(GameObject target)
        {
            if (ArrowGameObject != null && target != null)
            {
                ArrowGameObject.gameObject.SetActive(true);

                MapsGamingExamplesUtils.PlaceUIMarker(target, ArrowGameObject.transform);

                RectTransform rectTransform = ArrowGameObject.gameObject.GetComponent <RectTransform>();

                if (rectTransform == null)
                {
                    throw new System.Exception("Arrow GameObject does not have a renderer!");
                }

                ArrowOffsetY = rectTransform.rect.height / 2;
                ArrowGameObject.transform.position += new Vector3(0, ArrowOffsetY, 0);
            }
        }