public void ReceiveHeal(int heal) { Health += heal; Vector2 screenPos = Camera.main.WorldToScreenPoint(transform.position); screenPos.y += 32; UIManager.DynamicText dynamicText = UIManager.Instance.DisplayTextWithDuration("+" + heal.ToString(), screenPos, 2f); dynamicText.ParentToWorld(gameObject); dynamicText.SimpleMovement(new Vector2(0f, 16f), 1f); }
public void ReceiveDamage(int damage) { Health -= damage; m_damageTimer = m_interdamageTime; Vector2 screenPos = Camera.main.WorldToScreenPoint(transform.position); screenPos.y += 32; UIManager.DynamicText dynamicText = UIManager.Instance.DisplayTextWithDuration((-damage).ToString(), screenPos, 2f); dynamicText.ParentToWorld(gameObject); dynamicText.SimpleMovement(new Vector2(0f, 16f), 1f); }
private void RewardWithXP() { int xp = 10; GameManager.Instance.MainPlayer.Experience.AddXP(xp); GameObject anchor = GameManager.Instance.MainPlayer.gameObject; Vector2 screenPos = Camera.main.WorldToScreenPoint(anchor.transform.position); screenPos.y += 32; UIManager.DynamicText dynamicText = UIManager.Instance.DisplayTextWithDuration(string.Format("+{0} XP", xp), screenPos, 2f); dynamicText.Text.color = Color.green; dynamicText.ParentToWorld(anchor); dynamicText.SimpleMovement(new Vector2(0f, 16f), 1f); }