StatusIndicatorEntry Dequeue(StatPanel panel) { Poolable p = GameObjectPoolController.Dequeue(EntryPoolKey); StatusIndicatorEntry entry = p.GetComponent <StatusIndicatorEntry>(); entry.transform.SetParent(panel.statusParent.transform, false); entry.transform.localScale = Vector3.one; entry.gameObject.SetActive(true); return(entry); }
void PrepareDurationIndicator(StatusIndicatorEntry entry, DurationStatusCondition dur) { if (dur != null) { entry.Counter.SetActive(true); entry.Duration = dur.duration.ToString(); } else { entry.Counter.SetActive(false); } }
public void ShowSecondary(GameObject obj) { secondaryPanel.Display(obj); Clear(secondaryStatusEntries); foreach (StatusEffect eff in obj.GetComponentsInChildren <StatusEffect>()) { StatusIndicatorEntry entry = Dequeue(secondaryPanel); entry.Title = eff.GetType().Name.TrimStart(new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '_' }); PrepareRankIndicator(entry, eff.Rank); PrepareDurationIndicator(entry, eff.GetComponentInChildren <DurationStatusCondition>()); secondaryStatusEntries.Add(entry); } MovePanel(secondaryPanel, ShowKey, ref secondaryTransition); }
void PrepareRankIndicator(StatusIndicatorEntry entry, int rank) { entry.Img = Resources.Load <Sprite>("Status Icons/" + entry.Title); if (rank == 0 || rank > 3) { entry.Level = " "; } else if (rank == 1) { entry.Level = "I"; } else if (rank == 2) { entry.Level = "II"; } else if (rank == 3) { entry.Level = "III"; } }
void Enqueue(StatusIndicatorEntry entry) { Poolable p = entry.GetComponent <Poolable>(); GameObjectPoolController.Enqueue(p); }