Example #1
0
        void NewTextOverlay(TextOverlay overlayInstance)
        {
            if (!UIMainControl.EnableTextOverlay())
            {
                return;
            }

            Text txt = GetUnusedTextOverlay();

            txt.text = overlayInstance.msg;
            if (overlayInstance.useColor)
            {
                txt.color = overlayInstance.color;
            }
            else
            {
                txt.color = defaultColor;
            }

            txt.fontSize = (int)Mathf.Round(defaultFontSize * overlayInstance.scale);

            txt.transform.localPosition = GetScreenPos(overlayInstance.pos);
            txt.gameObject.SetActive(true);

            StartCoroutine(TextOverlayRoutine(overlayInstance.pos, txt));
        }
Example #2
0
        public Vector3 GetScreenPos(Vector3 worldPos)
        {
            Vector3 screenPos = Camera.main.WorldToScreenPoint(worldPos) * UIMainControl.GetScaleFactor();

            screenPos.z = 0;
            return(screenPos);
        }
Example #3
0
 void Awake()
 {
     instance=this;
 }