Пример #1
0
        // Create a label object along side a star
        private void generateStarLabel(StarData sData)
        {
            Vector3 position = starPositionFromNormalizedCoords(sData.NormalizedRightAscention, sData.NormalizedDeclination, sData.NormalisedDistance);

            StarLabel LabelItem = ((GameObject)Instantiate(Resources.Load("Stars/Label"))).GetComponent <StarLabel>();

            LabelItem.LabelComp.color = new Color(255.0f, 255.0f, 255.0f, labelOpacity);
            LabelItem.Label           = sData.Label;
            LabelItem.gameObject.transform.position = position.normalized * LABEL_DISTANCE;

            LabelItem.gameObject.transform.LookAt(transform.parent.parent.position, transform.parent.parent.up);
            sData.LabelObject = LabelItem;
            m_starLabels.Add(LabelItem);
        }
Пример #2
0
        // Create a label object along side a star
        public void GenerateStarLabel(StarData sData, Transform root = null)
        {
            StarLabel LabelItem = ((GameObject)Instantiate(StarLabelPrototype)).GetComponent <StarLabel>();

            LabelItem.gameObject.SetActive(true);

            if (root != null)
            {
                LabelItem.transform.parent = root;
            }

            LabelItem.LabelComp.color         = new Color(255.0f, 255.0f, 255.0f, labelOpacity);
            LabelItem.Label                   = sData.Label;
            LabelItem.transform.localPosition = Vector3.zero;
            if (sData.GameObjectRepresentation != null)
            {
                LabelItem.StarReference = sData.GameObjectRepresentation;
            }

            sData.LabelObject = LabelItem;
            m_starLabels.Add(LabelItem);
        }