public StatusSet(GameObject gameObject, SingleStatus ss) { icon = gameObject; singleStatus = ss; }
public void Add(SingleStatus s) { // Assume s' from and target is properly set statuses.Add(s); s.OnAttachedToEntity(); }
public void Init(Transform par, int dmg = -1, SingleStatus status = null) { // Debug.Log($"DamageTextFollower Init: {gameObject.name}. Damage: {dmg}. Status: {status}"); // RectTransform rect = GetComponent<RectTransform>(); // // ─── GAMEOBJECT INIT ───────────────────────────────────────────── // damageGO = transform.Find("damage text").gameObject; statusGO = transform.Find("status attach").gameObject; // Debug.Log($"DamageTextFollower Start: {damageGO.name}. "); icon = statusGO.transform.Find("icon").gameObject; description = statusGO.transform.Find("description").gameObject; // // ─── COMPONENT INIT ───────────────────────────────────────────────────────────── // canvasGroup = GetComponent <CanvasGroup>(); ResetStatus(); startMoving = true; // reset anchor position and anchored position of rect transform RectTransform rect = GetComponent <RectTransform>(); rect.SetParent(par.transform, false); rect.anchorMax = Constants.UI.MiddleCenterAnchor; rect.anchorMin = Constants.UI.MiddleCenterAnchor; rect.anchoredPosition = Vector3.zero; rect.localEulerAngles = Vector3.zero; if (isDamageInfo) { // Set damage text // Debug.Log($"DamageTextFollower Init: damageGO: {damageGO}. statusGO: {statusGO}."); damageGO.SetActive(true); statusGO.SetActive(false); TextMeshProUGUI dmgText = damageGO.GetComponent <TextMeshProUGUI>(); if (dmg > 0) { // red font dmgText.text = "-"; dmgText.color = Constants.UI.DamageColor; } else { dmgText.text = "+"; dmgText.color = Constants.UI.HealingColor; } dmgText.text += Mathf.Abs(dmg); } else { statusGO.SetActive(true); damageGO.SetActive(false); RectTransform rt = icon.GetComponent <RectTransform>(); Image image = icon.GetComponent <Image>(); image.sprite = status.icon; TextMeshProUGUI statusText = description.GetComponent <TextMeshProUGUI>(); if (status.expired) { statusText.text = "-"; } else { statusText.text = "+"; } // statusText.color = new Color32(255, 255, 255, 255); statusText.text += status.name; } }
public void Update(bool update = false) { if (this.controlledPlayer.target == null) { targetInfoGO.SetActive(false); } else { targetInfoGO.SetActive(true); Entity target = controlledPlayer.target.GetComponent <Entity>(); // Status if (!update) { // init foreach (StatusSet item in statusSets.Values) { UIManager.DestroyIconGO(item.icon); } statusSets.Clear(); UIManager.OnStatusListChange(statusListGO, target, statusSets, 5); } else { UIManager.UpdateStatusList(statusSets); } // HP if (DebugSwitch.UIManager) { Debug.Log($"UIM InitTargetInfo {target.name} "); } bossName.text = target.name; RectTransform rect = hpMask.GetComponent <RectTransform>(); Vector3 scale = rect.localScale; scale.x = (float)target.healthPoint / target.maxHP; rect.localScale = scale; float percent = (Mathf.CeilToInt(scale.x * 1000)) / 10; if (DebugSwitch.UIManager) { Debug.Log($"UIM InitTargetInfo: Set HP percent {percent} "); } hpPercent.text = percent.ToString() + "%"; // CastBar if (target.casting && target.castingStatus.showInCastFrame) { castFrame.SetActive(true); CastGroup sg = target.castingStatus; if (DebugSwitch.UIManager) { Debug.Log($"TargetInfoClass Init: StatusGroup has {sg.statuses.Count} statuses."); } SingleStatus s = sg.statuses[0]; RectTransform castRect = castMask.GetComponent <RectTransform>(); Vector3 castScale = castRect.localScale; castScale.x = (float)s.countdown / s.duration; castRect.localScale = castScale; moveName.text = sg.actual.name; } else { castFrame.SetActive(false); } } }
public void AddEvent(SingleStatus status) { // Debug.Log($"BM AddEvent: {status}"); eventQueue.Add(status); }