コード例 #1
0
    /// <summary>
    /// 更新
    /// </summary>
    protected override void Update()
    {
        if (m_Gameplay != null)
        {
            SpacecraftEntity main = GetMainEntity();
            if (main != null)
            {
                bool isFighting = IsBattling();

                float fireCD = main.GetFireCountdown();
                //float fireCDMax = 10.0f;// main.GetAttribute(AircraftAttributeType.peerlessTopLimit);

                m_CooldownBox.gameObject.SetActive(isFighting && fireCD > 0);
                if (m_CooldownBox.gameObject.activeSelf)
                {
                    m_CooldownText.text = string.Format(TableUtil.GetLanguageString("hud_text_id_1014"), fireCD > 0 ? (int)fireCD : 0);
                }
            }
        }
    }
コード例 #2
0
    /// <summary>
    /// 更新
    /// </summary>
    protected override void Update()
    {
        bool visibleOld = GetTransform().gameObject.activeSelf;
        bool visibleNew = !IsWatchOrUIInputMode() && !IsDead() && !IsLeaping();

        if (visibleNew != visibleOld)
        {
            GetTransform().gameObject.SetActive(visibleNew);
        }

        if (!visibleNew)
        {
            return;
        }

        SpacecraftEntity main = GetMainEntity();

        if (main != null)
        {
            bool IsFighting = IsBattling();
            if (IsFighting)
            {
                if (!m_IsBattleState)
                {
                    m_HurtTime = Time.time;
                }

                float fireCD    = main.GetFireCountdown();
                float fireCDMax = 10.0f;// main.GetAttribute(AircraftAttributeType.peerlessTopLimit);

                m_CountdownBox.gameObject.SetActive(IsFighting && fireCD > 0);
                if (m_CountdownBox.gameObject.activeSelf)
                {
                    m_CountdownText.text        = string.Format(TableUtil.GetLanguageString("hud_text_id_1014"), fireCD > 0 ? (int)fireCD : 0);
                    m_CountdownImage.fillAmount = fireCD / fireCDMax;

                    m_CruiseIcon.color = FadeColor;
                    m_BattleIcon.color = FadeColor;
                }
                else
                {
                    m_CruiseIcon.color = Color.white;
                    m_BattleIcon.color = Color.white;
                }

                m_Animator.SetBool("Fighting", true);
                if (fireCD > 0)
                {
                    m_Animator.SetBool("Hurting", true);
                }
                else
                {
                    m_Animator.SetBool("Hurting", (Time.time - m_HurtTime < 5.0f));
                }
            }
            else
            {
                if (m_IsBattleState)
                {
                    m_HurtTime = 0.0f;
                }

                m_CountdownBox.gameObject.SetActive(false);
                m_CruiseIcon.color = Color.white;
                m_BattleIcon.color = Color.white;

                m_Animator.SetBool("Fighting", false);
                m_Animator.SetBool("Hurting", Time.time - m_HurtTime < 5.0f);
            }

            m_IsBattleState = IsFighting;
        }
    }
コード例 #3
0
    /// <summary>
    /// 更新
    /// </summary>
    protected override void Update()
    {
        SpacecraftEntity main = GetMainEntity();

        if (main != null)
        {
            bool IsFighting = IsBattling();

            float fireCD = main.GetFireCountdown();
            //float fireCDMax = 10.0f;// main.GetAttribute(AircraftAttributeType.peerlessTopLimit);

            m_CooldownBox.gameObject.SetActive(IsFighting && fireCD > 0);
            if (m_CooldownBox.gameObject.activeSelf)
            {
                m_CooldownText.text = string.Format(TableUtil.GetLanguageString("hud_text_id_1014"), fireCD > 0 ? (int)fireCD : 0);
            }

            m_HpText.text = Mathf.FloorToInt((float)main.GetAttribute(AttributeName.kHP)).ToString();
            m_SpText.text = Mathf.FloorToInt((float)main.GetAttribute(AttributeName.kShieldValue)).ToString();

            State state = State.Normal;
            if (IsFighting)
            {
                state = fireCD > 0 ? State.BattleCD : State.Battle;
            }
            else
            {
                state = Time.time - m_HurtTime < 10.0f ? State.Hurt : State.Normal;
            }

            if (m_State != state)
            {
                m_Animator.ResetTrigger("Normal");
                m_Animator.ResetTrigger("Injured");
                m_Animator.ResetTrigger("Battle");
                m_Animator.ResetTrigger("Ready");

                m_State = state;
                switch (m_State)
                {
                case State.Normal:
                    m_StateText.text = TableUtil.GetLanguageString("hud_text_id_1009");
                    m_HotkeyBox.gameObject.SetActive(false);
                    m_Animator.SetTrigger("Normal");
                    break;

                case State.Hurt:
                    m_StateText.text = TableUtil.GetLanguageString("hud_text_id_1010");
                    m_HotkeyBox.gameObject.SetActive(true);
                    m_Animator.SetTrigger("Injured");
                    break;

                case State.BattleCD:
                    m_StateText.text = TableUtil.GetLanguageString("hud_text_id_1011");
                    m_HotkeyBox.gameObject.SetActive(false);
                    m_Animator.SetTrigger("Battle");
                    break;

                case State.Battle:
                    m_StateText.text = TableUtil.GetLanguageString("hud_text_id_1012");
                    m_HotkeyBox.gameObject.SetActive(true);
                    m_Animator.SetTrigger("Ready");
                    break;
                }
            }
        }
    }