public void AddToFeed(string action, int expEarned, bool isBonus = false) { if (feedList.Count > queueBuffer - 1) { feedQueue.Add(new ActionContainer(action, expEarned, isBonus)); return; } ActionContainer currentAC = GetContainerByName(action); if (currentAC != null) { currentAC.expAward += expEarned; currentAC.afi.targetReward = currentAC.expAward; currentAC.IncrementStack(); } else { UILabel newFeedInstance = (UILabel)Instantiate(labelPrefab); newFeedInstance.transform.parent = actionFeedParent; newFeedInstance.transform.localScale = Vector3.one; newFeedInstance.fontSize = labelPrefab.fontSize - ((isBonus) ? 2 : 0); ActionFeedItem afItem = newFeedInstance.GetComponent <ActionFeedItem>(); afItem.manager = this; afItem.targetPos = -Vector3.up * feedList.Count * feedSpacing; afItem.SetDuration(feedDuration); afItem.Initialize(feedList.Count); currentAC = new ActionContainer(action, expEarned, isBonus); currentAC.label = newFeedInstance; currentAC.afi.targetReward = expEarned; currentAC.duration = feedDuration; currentAC.lastActionTime = Time.time; feedList.Add(currentAC); } if (isBonus) { Color col = currentAC.label.defaultColor * 0.7f; col.g *= 0.9f; col.b *= 0.9f; currentAC.label.color = col; } currentAC.afi.baseText = ((isBonus) ? "+" : "") + currentAC.fullName; }