public void Begin(Transform targetTf, string textString, FloatingUI.Style style = FloatingUI.Style.None, Sprite icon = null) { image.sprite = icon; if (style == FloatingUI.Style.Produce) { image.sprite = produceIcon; } else if (style == FloatingUI.Style.Supplies) { image.sprite = suppliesIcon; } image.gameObject.SetActive(image.sprite != null); SetText(textString, style); var tf = transform; var rot = tf.localEulerAngles; rot.x = FindObjectOfType <GameManager>().Camera.UICamera.transform.eulerAngles.x; tf.localEulerAngles = rot; tf.position = targetTf.position; Show(); animator.enabled = true; }
private void SetText(string textString, FloatingUI.Style style) { if (string.IsNullOrEmpty(textString)) { // TODO turn all text off normalText.gameObject.SetActive(false); return; } if (style == FloatingUI.Style.None || style == FloatingUI.Style.Produce || style == FloatingUI.Style.Supplies) { normalText.text = textString; normalText.gameObject.SetActive(true); combatText.gameObject.SetActive(false); } else if (style == FloatingUI.Style.Combat) { combatText.text = textString; normalText.gameObject.SetActive(false); combatText.gameObject.SetActive(true); } }
public void ShowFloatingUI(Transform tf, string text, FloatingUI.Style style = FloatingUI.Style.None, Sprite icon = null) { floatingUI.Show(tf, text, style, icon); }