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)); }
public Vector3 GetScreenPos(Vector3 worldPos) { Vector3 screenPos = Camera.main.WorldToScreenPoint(worldPos) * UIMainControl.GetScaleFactor(); screenPos.z = 0; return(screenPos); }
void Awake() { instance=this; }