public void SpawnXpReceivedText(int xp, XpReceivedText.ReceiveXpAnimation animation) { GameObject go = Instantiate(xpReceivedTextPrefab, uiCanvas); RectTransform rectTransform = go.GetComponent <RectTransform>(); Vector3 spawnPosition = GetRandomSpawnPositionWithinBounds(rectTransform); rectTransform.anchoredPosition = spawnPosition; go.GetComponentInChildren <XpReceivedText>().Play(xp, animation); }
public void ReceiveXP(int xp, XpReceivedText.ReceiveXpAnimation animation) { SetCurrentXP(xp); ui.SpawnXpReceivedText(xp, animation); ui.SetXP(currentXP); if (XPIsMaxedOut()) { LevelUp(); } }