Exemplo n.º 1
0
 private void InitHPBarView()
 {
     HPBarProvider.CreateHPBar(this, m_HPBarAnchor, out m_root, out m_positionRoot, out m_HPBar, out m_recentDamage, out m_backgroundHPBar, out m_shadowHPBar, out m_monsterNameLabel);
     if (m_HPBar != null)
     {
         m_dummyObject = m_HPBar.transform.parent.gameObject;
         m_HPBarRoot   = m_dummyObject.transform.parent;
         MonoBehaviour[] components = m_HPBarRoot.GetComponents <MonoBehaviour>();
         for (Int32 i = 0; i < components.Length; i++)
         {
             if (components[i] is IMonsterTooltip)
             {
                 ((IMonsterTooltip)components[i]).InitializeMonsterTooltip(this);
             }
         }
         InitBuffs();
     }
 }
Exemplo n.º 2
0
 private void LateUpdate()
 {
     if (m_positionRoot != null && m_visible)
     {
         Boolean flag = false;
         Single  num  = 100f;
         Single  num2 = 0f;
         Single  num3 = 0f;
         Single  num4 = num;
         m_offsetDir = 1;
         Single  num5          = 0f;
         Vector3 localPosition = m_positionRoot.transform.localPosition;
         localPosition.y = 30f;
         m_positionRoot.transform.localPosition = localPosition;
         if (m_root.transform.localPosition.y + m_positionRoot.transform.localPosition.y > 570f)
         {
             m_offsetDir = -1;
             Vector3 localPosition2 = m_positionRoot.transform.localPosition;
             localPosition2.y = 570f - m_root.transform.localPosition.y;
             m_positionRoot.transform.localPosition = localPosition2;
         }
         UpdateCollisionRects();
         Int32 num6 = 100;
         while (HPBarProvider.CheckForCollision(this))
         {
             Single num7 = 8f;
             Single num8 = (m_collisionOffset + num7) * m_offsetDir;
             num5 += num8;
             if (m_offsetDir > 0 && m_root.transform.localPosition.y + m_positionRoot.transform.localPosition.y + num5 > 570f)
             {
                 flag        = true;
                 m_offsetDir = -1;
                 num8       -= num5;
                 num5        = 0f;
             }
             else if (!flag && Mathf.Abs(num5) > num4)
             {
                 if (m_offsetDir > 0)
                 {
                     num2 = num5;
                     num8 = num8 - num5 + num3;
                     num5 = num3;
                 }
                 else
                 {
                     num3  = num5;
                     num8  = num8 - num5 + num2;
                     num5  = num2;
                     num4 += num;
                 }
                 m_offsetDir *= -1;
             }
             m_barCollisionBox.y   = m_barCollisionBox.y + num8;
             m_nameCollisionBox.y  = m_nameCollisionBox.y + num8;
             m_buffsCollisionBox.y = m_buffsCollisionBox.y + num8;
             if (num6-- < 0)
             {
                 num5 = 0f;
                 Debug.LogWarning("To many HP bar collision checks");
                 break;
             }
         }
         m_targetYPos = m_positionRoot.transform.localPosition.y + num5;
         if (m_targetYPos != m_lastYPos)
         {
             m_lastYPos += (m_targetYPos - m_lastYPos) * Time.deltaTime * 10f;
         }
         if (m_root.transform.localPosition.y + m_lastYPos > 570f)
         {
             m_lastYPos = 570f - m_root.transform.localPosition.y;
         }
         localPosition   = m_positionRoot.transform.localPosition;
         localPosition.y = m_lastYPos;
         m_positionRoot.transform.localPosition = localPosition;
         HPBarProvider.AddForCollision(this);
     }
 }
Exemplo n.º 3
0
 protected override void OnDestroy()
 {
     base.OnDestroy();
     HPBarProvider.DestroyHPBar(this);
 }