コード例 #1
0
ファイル: PauseUI.cs プロジェクト: dek0058/Dark-Tower
        public void Unpause()
        {
            if (m_is_init)
            {
                return;
            }

            PlayerComponent player = InGameManager.Instance.local_player;

            if (player != null)
            {
                player.Unpause();
            }
        }
コード例 #2
0
ファイル: HealthUI.cs プロジェクト: dek0058/Dark-Tower
        /// <summary>
        /// 현재 선택된 유닛의 체력을 갱신합니다.
        /// </summary>
        public void UpdateHealth()
        {
            RectTransform   l_transform;
            bool            updown;
            PlayerComponent local_player = InGameManager.Instance.local_player;
            int             hp           = Mathf.CeilToInt(local_player.character.unit.rank.hp);
            int             current_hp   = (int)local_player.character.unit.rank.current_hp;

            if (current_hp < 0)
            {
                current_hp = 0;
            }

            Debug.Log("hp1 : " + current_hp);
            RemoveAll();
            Debug.Log("hp2 : " + current_hp);
            Add(hp);

            /// TODO : 현재 체력에 비례하여 빈 체력으로 변경해줘야 함
            Debug.Log("hp : " + current_hp);
            for (int i = 0; i < m_healths.Count; i++)
            {
                if (current_hp >= (i + 1))
                {
                    m_healths[i].GetComponent <HealthComponent>().Active(true);
                }
                else
                {
                    m_healths[i].GetComponent <HealthComponent>().Active(false);
                }

                updown      = i < k_updown_point ? true : false;
                l_transform = m_healths[i].transform as RectTransform;
                if (updown)
                {
                    l_transform.anchorMin += new Vector2(k_Icon_Acnchor_Width * i, 0f);
                    l_transform.anchorMax += new Vector2(k_Icon_Acnchor_Width * i, 0f);
                }
                else
                {
                    l_transform.anchorMin += new Vector2(k_Icon_Acnchor_Width * (i - k_updown_point), k_Icon_Acnchor_Height);
                    l_transform.anchorMax += new Vector2(k_Icon_Acnchor_Width * (i - k_updown_point), k_Icon_Acnchor_Height);
                }
            }
        }