public void DestroyHealthBar() { if (m_fxHelper != null) { m_fxHelper.m_HealthBarFXAttachment = null; m_fxHelper = null; } if (m_healthBar != null && m_healthBar.mDMono != null) { m_healthBar.Show(false); GameObject.Destroy(m_healthBar.mDMono.gameObject); m_healthBar = null; m_healthBarTransform = null; } m_moveCtrl = null; m_lastMoveState = MoveController.CombatantMoveState.kIdle; Hidden = false; }
public void InitHealthBar() { m_fxHelper = mDMono.gameObject.GetComponent <MoveEditor.FXHelper>(); if (m_locator == null) { m_locator = CachedTransform.Find("HealthBarTarget"); } if (m_locator == null) { if (m_fxHelper != null) { m_locator = m_fxHelper.HeadNubTransform; } } if (m_locator == null) { m_locator = CachedTransform; } if (m_healthBar == null) { m_healthBar = Hotfix_LT.UI.HealthBarHUDController.Instance.GetHUD(); } if (m_healthBar == null) { EB.Debug.LogError("InitHealthBar: m_healthBar is null"); return; } if (IsLeft()) { m_healthBar.HpColor = Color.green; } else if (IsRight()) { m_healthBar.HpColor = Color.red; } else { EB.Debug.LogError("InitHealthBar: direction error"); } m_healthBar.MaxHp = 0; m_healthBar.Hp = 0; m_healthBar.TransitionHp = 0; m_healthBar.Shield = 0; m_healthBar.TransitionShield = 0; m_healthBarTransform = m_healthBar.mDMono.transform; if (m_fxHelper != null) { m_fxHelper.m_HealthBarFXAttachment = m_healthBar.buffAnchor; } m_healthBarMonotor = m_healthBar.mDMono.GetComponent <Main.Combat.UI.HealthBarHUDMonitor>(); m_healthBarMonotor.SetLocator(m_locator); }