コード例 #1
0
    // Update is called once per frame
    void Update()
    {
        switch (m_ScenePhase)
        {
        case ScenePhase.START:
            MasterDataEnemyGroup[] master_data_array = BattleParam.m_MasterDataCache.getAllEnemyGroup();
            if (master_data_array != null)
            {
                m_IsEnableEnemyUI = true;
            }
            initPlayerParty1();

            m_ScenePhase = ScenePhase.INIT;
            break;

        case ScenePhase.INIT:
            m_ScenePhase = ScenePhase.PLAYER_SETUP;
            break;

        case ScenePhase.PLAYER_SETUP:
            setup_for_screen();
            m_ScenePhase = ScenePhase.PLAYER_SETUP_WAIT;
            break;

        case ScenePhase.PLAYER_SETUP_WAIT:
            // OnPushButtonStart() が呼ばれれば進む.
            update_setup_ui();
            break;

        case ScenePhase.INIT_PLAYER:
            BattleParam.m_MasterDataCache.clearCachePlayerAll();
            BattleParam.m_MasterDataCache.clearCacheEnemyAll();
            setup_from_screen();
            initPlayerParty2();

            BattleParam.QuestInitialize(null);

            m_ScenePhase = ScenePhase.INIT_ENEMY;
            break;

        case ScenePhase.INIT_ENEMY:
            resetBattleRequest();
            createBattleRequest();
            m_ScenePhase = ScenePhase.INIT_BATTLE_MANAGER;
            break;

        case ScenePhase.INIT_BATTLE_MANAGER:
        {
            GameObject effect_prefab = Resources.Load <GameObject>("Prefab/BattleScene/InGameEffectPrefab");
            GameObject effect_obj    = Instantiate(effect_prefab);      // effect_prefabのコンポーネントを書き換えると以前に書き換えた情報が残っているので別オブジェクトを一回生成
            SceneObjReferGameMainEffect effect_assign = effect_obj.GetComponent <SceneObjReferGameMainEffect>();
            SceneObjReferGameMain.Instance.setEffectAssignObj(effect_assign);
        }
            BattleParam.BattleInitialize(BattleParam.m_BattleRequest, null);
            BattleParam.setKensyoParam(m_SkillTurnCondition, m_KobetsuHP_EnemyAtkRate, m_KobetsuHPEnemyAttackAll, m_KobetsuHPEnemyTargetHate);
            BattleParam.BattleStart();
            m_ScenePhase = ScenePhase.BATTILING;
            break;

        case ScenePhase.BATTILING:
            if (BattleParam.getBattlePhase() == BattleParam.BattlePhase.NOT_BATTLE)
            {
                // クリアした
                bool is_next_battle = createBattleRequest();
                if (is_next_battle)
                {
                    // 次の戦闘がある
                    m_ScenePhase = ScenePhase.INIT_BATTLE_MANAGER;
                }
                else
                {
                    // 終了
                    BattleParam.endBattleScene();
                    m_ScenePhase = ScenePhase.INIT;
                }
            }
            if (BattleParam.getBattlePhase() == BattleParam.BattlePhase.RETIRE)
            {
                // ゲームオーバー
                BattleParam.endBattleScene();
                m_ScenePhase = ScenePhase.INIT;
            }
            break;

        default:
            break;
        }
    }
コード例 #2
0
ファイル: BattleAutoPlay.cs プロジェクト: mliuzailin/GitGame
    public void update(float delta_time)
    {
        if (m_IsPlaying)
        {
            if (m_IsDebugStopMode)
            {
                bool mouse_button = Input.GetMouseButton(0);
                if (mouse_button)
                {
                    BattleParam.setAutoPlayState(BattleParam.AutoPlayState.CANCEL);
                    m_IsPlaying     = false;
                    m_AutoPlayPhase = AutoPlayPhase.NOT_INPUT_PHASE;
                    return;
                }
            }

            BattleParam.BattlePhase battle_phase = BattleParam.getBattlePhase();
            if (battle_phase == BattleParam.BattlePhase.INPUT ||
                battle_phase == BattleParam.BattlePhase.INPUT_HANDLING
                )
            {
                if (m_IsFullField)
                {
                    return;
                }

                Vector2 hand_pos    = new Vector2(2.0f, 5.0f); //画面外の見えない位置に初期化
                bool    is_touching = false;

                switch (m_AutoPlayPhase)
                {
                case AutoPlayPhase.NOT_INPUT_PHASE:
                {
                    // オートプレイの停止判定
                    if (m_AI.isStopAutoPlay())
                    {
                        BattleParam.setAutoPlayState(BattleParam.AutoPlayState.CANCEL);
                        m_IsPlaying     = false;
                        m_AutoPlayPhase = AutoPlayPhase.NOT_INPUT_PHASE;
                        m_IsFullField   = false;
                        return;
                    }

                    // プレイヤーフェイズに戻ってきたときにここに来る.
                    m_Timer         = 1.0f;
                    m_AutoPlayPhase = AutoPlayPhase.START_WAIT;
                }
                break;

                case AutoPlayPhase.START_WAIT:
                {
                    m_Timer -= delta_time;
                    if (m_Timer <= 0.0f)
                    {
                        m_PanelInfo = new AI.PanelInfo();
                        m_PanelInfo.m_HandElements  = new MasterDataDefineLabel.ElementType[m_BattleCardManager.m_HandArea.getCardMaxCount()];
                        m_PanelInfo.m_NextElements  = new MasterDataDefineLabel.ElementType[m_BattleCardManager.m_NextArea.getCardMaxCount()];
                        m_PanelInfo.m_FieldElements = new AI.CostInfo[m_BattleCardManager.m_FieldAreas.getFieldAreaCountMax()];
                        for (int field_idx = 0; field_idx < m_PanelInfo.m_FieldElements.Length; field_idx++)
                        {
                            m_PanelInfo.m_FieldElements[field_idx] = new AI.CostInfo(m_BattleCardManager.m_FieldAreas.getFieldArea(field_idx).getCardMaxCount());
                        }
                        m_PanelInfo.m_FieldCosts = new int[m_PanelInfo.m_FieldElements.Length];
                        m_PanelInfo.m_IsBoosts   = new bool[m_PanelInfo.m_FieldElements.Length];

                        // 思考ルーチン初期化
                        m_AI.initThink(_updatePanelInfo());

                        // リミブレスキルをチェック
                        GlobalDefine.PartyCharaIndex limit_break_skill_caster = m_AI.getLimitBreakSkillCaster();
                        if (BattleParam.IsEnableLBS(limit_break_skill_caster) == false)
                        {
                            limit_break_skill_caster = GlobalDefine.PartyCharaIndex.ERROR;
                        }

                        if (limit_break_skill_caster >= GlobalDefine.PartyCharaIndex.LEADER &&
                            limit_break_skill_caster <= GlobalDefine.PartyCharaIndex.FRIEND
                            )
                        {
                            // リミブレスキル発動
                            BattleParam.RequestLBS(limit_break_skill_caster);
                            m_AutoPlayPhase = AutoPlayPhase.NOT_INPUT_PHASE;
                            m_IsFullField   = false;
                        }
                        else
                        {
                            // パネル操作開始
                            m_PanelPutTimer        = 0.0f;
                            m_PanelPutCountGoal    = m_AI.getPanelPutCount();
                            m_PanelPutCountCurrent = 0;

                            float count_down_time = BattleSceneManager.Instance.PRIVATE_FIELD.calcCountDownTime();
                            if (count_down_time < COUNT_DOWN_TIME)
                            {
                                count_down_time = COUNT_DOWN_TIME;
                            }

                            m_PanelPutInterval = count_down_time / m_PanelPutCountGoal * (1.0f + 1.0f / m_PanelPutCountGoal);
                            m_AutoPlayPhase    = AutoPlayPhase.CARD_GET;
                        }
                    }
                }
                break;

                case AutoPlayPhase.CARD_GET:
                {
                    m_PanelPutTimer += delta_time;

                    float card_get_time = m_PanelPutCountCurrent * m_PanelPutInterval;            // カードを掴む時刻

                    if (m_PanelPutTimer >= card_get_time)
                    {
                        if (m_BattleCardManager != null)
                        {
                            if (m_BattleCardManager.m_FieldAreas.getFieldArea(0).isFull() &&
                                m_BattleCardManager.m_FieldAreas.getFieldArea(1).isFull() &&
                                m_BattleCardManager.m_FieldAreas.getFieldArea(2).isFull() &&
                                m_BattleCardManager.m_FieldAreas.getFieldArea(3).isFull() &&
                                m_BattleCardManager.m_FieldAreas.getFieldArea(4).isFull()
                                )
                            {
                                BattleSceneManager.Instance.PRIVATE_FIELD.skipCountDown();
                                m_IsFullField   = true;
                                m_AutoPlayPhase = AutoPlayPhase.NOT_INPUT_PHASE;
                                return;
                            }
                        }

                        // カウントダウンスキップ判定
                        if (m_AI.isSkipCountDown())
                        {
                            BattleSceneManager.Instance.PRIVATE_FIELD.skipCountDown();
                            m_AutoPlayPhase = AutoPlayPhase.NOT_INPUT_PHASE;
                            m_IsFullField   = false;
                            return;
                        }

                        // 思考ルーチン呼び出し
                        int hand_index  = 0;
                        int field_index = 0;
                        m_AI.execThink(ref hand_index, ref field_index, _updatePanelInfo());

                        m_StartPosition = new Vector2(hand_index, 1.0f - 0.3f);
                        m_GoalPosition  = new Vector2(field_index, 0.0f - 0.5f);

                        hand_pos    = m_StartPosition;
                        is_touching = true;

                        float card_put_time = (m_PanelPutCountCurrent + 1) * m_PanelPutInterval - CARD_PUT_TIME;            // カードを置く時刻
                        m_Duration = card_put_time - m_PanelPutTimer;
                        m_Duration = Mathf.Max(m_Duration, 0.0f);
                        m_Duration = Mathf.Min(m_Duration, CARD_MOVE_TIME_MAX);

                        m_Timer         = 0.0f;
                        m_AutoPlayPhase = AutoPlayPhase.CARD_MOVE;
                    }
                }
                break;

                case AutoPlayPhase.CARD_MOVE:
                {
                    m_PanelPutTimer += delta_time;
                    m_Timer         += delta_time;
                    if (m_Timer < m_Duration)
                    {
                        float t = m_Timer / m_Duration;

                        Vector2 vec = m_GoalPosition - m_StartPosition;
                        vec.x      *= t * t;    // 横方向は動き始めをゆっくりにする(2枚以上を掴まないようにするため)
                        vec.y      *= t;
                        hand_pos    = m_StartPosition + vec;
                        is_touching = true;
                    }
                    else
                    {
                        hand_pos    = m_GoalPosition;
                        is_touching = true;

                        m_AutoPlayPhase = AutoPlayPhase.CARD_PUT;
                    }
                }
                break;

                case AutoPlayPhase.CARD_PUT:        // タッチしていないフレームが最低1フレームはあるようにするための処理
                {
                    m_PanelPutTimer += delta_time;

                    m_PanelPutCountCurrent++;

                    hand_pos    = m_GoalPosition;
                    is_touching = false;

                    m_AutoPlayPhase = AutoPlayPhase.CARD_GET;
                }
                break;
                }

                BattleSceneManager.Instance.setOverrideTouchMode(BattleSceneManager.Instance.getCardFieldScreenPos(hand_pos.x, hand_pos.y), is_touching);
            }
            else
            {
                m_AutoPlayPhase = AutoPlayPhase.NOT_INPUT_PHASE;
                m_IsFullField   = false;
            }
        }
        else
        {
            m_AutoPlayPhase = AutoPlayPhase.NOT_INPUT_PHASE;
            m_IsFullField   = false;
        }
    }
コード例 #3
0
    // Update is called once per frame
    void Update()
    {
        if (BattleParam.m_PlayerParty != null && BattleParam.isActiveBattle())
        {
            BattleSceneUtil.MultiInt damage_value = BattleParam.m_PlayerParty.getDispDamageValue();
            BattleSceneUtil.MultiInt heal_value   = BattleParam.m_PlayerParty.getDispRecoveryValue();

            if (BattleParam.m_PlayerParty.m_HPCurrent.getValue(GlobalDefine.PartyCharaIndex.MAX) != m_PartyHp ||
                BattleParam.m_PlayerParty.m_HPMax.getValue(GlobalDefine.PartyCharaIndex.MAX) != m_PartyHpMax
                )
            {
                m_PartyHp    = BattleParam.m_PlayerParty.m_HPCurrent.getValue(GlobalDefine.PartyCharaIndex.MAX);
                m_PartyHpMax = BattleParam.m_PlayerParty.m_HPMax.getValue(GlobalDefine.PartyCharaIndex.MAX);
                if (m_PartyHpObject != null)
                {
                    TextMesh text_mesh = m_PartyHpObject.GetComponent <TextMesh>();
                    if (text_mesh != null)
                    {
                        text_mesh.text = "HP:" + m_PartyHp.ToString() + "/" + m_PartyHpMax.ToString();
                    }
                }
            }

            if (damage_value != null)
            {
                int hp_delta = damage_value.getValue(GlobalDefine.PartyCharaIndex.MAX);
                if (hp_delta > 0)
                {
                    DrawDamageManager.showDamage(m_PartyHpDamageLocale.transform, hp_delta, EDAMAGE_TYPE.eDAMAGE_TYPE_WEEK);
                }
            }

            if (heal_value != null)
            {
                int hp_delta = heal_value.getValue(GlobalDefine.PartyCharaIndex.MAX);
                if (hp_delta > 0)
                {
                    DrawDamageManager.showDamage(m_PartyHpDamageLocale.transform, hp_delta, EDAMAGE_TYPE.eDAMAGE_TYPE_HEAL);
                    EffectManager.Instance.playEffect(SceneObjReferGameMain.Instance.m_EffectPrefab.m_Heal_03, new Vector3(2.0f * 0.05f, -0.9609375f * 0.05f, 0.0f), Vector3.zero, m_PartyHpObject.transform, null, 0.15f);
                }
            }

            if (BattleParam.m_PlayerParty.m_PartyTotalSP != m_PartySp ||
                BattleParam.m_PlayerParty.m_PartyTotalSPMax != m_PartySpMax
                )
            {
                int old_sp = m_PartySp;
                m_PartySp    = BattleParam.m_PlayerParty.m_PartyTotalSP;
                m_PartySpMax = BattleParam.m_PlayerParty.m_PartyTotalSPMax;
                if (m_PartySpObject != null)
                {
                    TextMesh text_mesh = m_PartySpObject.GetComponent <TextMesh>();
                    if (text_mesh != null)
                    {
                        text_mesh.text = "SP:" + m_PartySp.ToString() + "/" + m_PartySpMax.ToString();
                    }
                    if (m_PartySp > old_sp)
                    {
                        EffectManager.Instance.playEffect(SceneObjReferGameMain.Instance.m_EffectPrefab.m_Heal_SP, new Vector3(2.0f * 0.05f, -0.4f * 0.05f, 0.0f), Vector3.zero, m_PartySpObject.transform, null, 0.125f);
                    }
                }
            }

            // パーティ状態異常
            {
                Transform ailment_object = transform.Find("PartyAilment");
                if (ailment_object != null)
                {
                    InGameAilmentIcon ailment_icon = ailment_object.GetComponent <InGameAilmentIcon>();
                    if (ailment_icon != null)
                    {
                        StatusAilmentChara ailment_info = BattleParam.m_PlayerParty.m_Ailments.getAilment(GlobalDefine.PartyCharaIndex.MAX);
                        ailment_icon.SetStatus(ailment_info);
                    }
                }
            }

            bool is_control = false;
            if (BattleParam.getBattlePhase() == BattleParam.BattlePhase.INPUT)
            {
                is_control = true;
            }

            // ヒーロースキル発動ボタン
            {
                Transform hero_skill_button_trans = transform.Find("Canvas/ButtonHeroSkill");
                if (hero_skill_button_trans != null)
                {
                    Button button = hero_skill_button_trans.GetComponent <Button>();
                    if (button != null)
                    {
                        bool is_button_enable = (is_control && BattleParam.m_PlayerParty.m_BattleHero.checkHeroSkillTurn());
                        button.interactable = is_button_enable;

                        Transform btn_txt = hero_skill_button_trans.Find("Text");
                        if (btn_txt != null)
                        {
                            Text txt = btn_txt.GetComponent <Text>();
                            if (txt != null)
                            {
                                txt.text = BattleParam.m_PlayerParty.m_BattleHero.getSkillTurn().ToString() + "/HERO";
                            }
                        }
                    }
                }
            }

            GlobalDefine.PartyCharaIndex provoke_target = BattleParam.m_PlayerParty._getProvokeTarget();
            for (int idx = 0; idx < (int)GlobalDefine.PartyCharaIndex.MAX; idx++)
            {
                string chara_name             = "";
                int    chara_id               = 0;
                int    link_chara_id          = 0;
                string hp_text                = "";
                string skill_name             = "";
                bool   is_active_skill_button = false;

                CharaOnce chara_once = BattleParam.m_PlayerParty.getPartyMember((GlobalDefine.PartyCharaIndex)idx, CharaParty.CharaCondition.EXIST);
                bool      is_alive   = false;
                if (chara_once != null)
                {
                    MasterDataParamChara chara_master = chara_once.m_CharaMasterDataParam;

                    int   hp      = BattleParam.m_PlayerParty.m_HPCurrent.getValue((GlobalDefine.PartyCharaIndex)idx);
                    float hp_rate = hp / (float)BattleParam.m_PlayerParty.m_HPMax.getValue((GlobalDefine.PartyCharaIndex)idx);

                    string hp_color = "white";
                    if (hp_rate >= 0.5f)
                    {
                        hp_color = "white";
                        is_alive = true;
                    }
                    else
                    if (hp_rate >= 0.2f)
                    {
                        hp_color = "yellow";
                        is_alive = true;
                    }
                    else
                    if (hp_rate > 0.0f)
                    {
                        hp_color = "red";
                        is_alive = true;
                    }
                    else
                    {
                        hp_color = "#808080";
                    }

                    // キャラ名
                    chara_name = "<color=" + hp_color + ">" + chara_master.name + "</color>";

                    // キャライメージ
                    chara_id = (int)chara_master.fix_id;

                    // リンクキャライメージ
                    if (chara_once.m_LinkParam != null)
                    {
                        link_chara_id = (int)chara_once.m_LinkParam.m_CharaID;
                    }

                    int atk_percent = (int)(InGameUtil.getCharaAttakPowScale(chara_once, BattleParam.m_PlayerParty.m_Ailments.getAilment((GlobalDefine.PartyCharaIndex)idx)) * 100.0f);
                    int hp_percent  = (int)(BattleParam.m_PlayerParty.m_HPMax.getValue((GlobalDefine.PartyCharaIndex)idx) / (float)BattleParam.m_PlayerParty.m_HPBase.getValue((GlobalDefine.PartyCharaIndex)idx) * 100.0f);

                    // キャラ個別HP
                    hp_text = "<color=" + hp_color + ">"
                              + BattleParam.m_PlayerParty.m_HPCurrent.getValue((GlobalDefine.PartyCharaIndex)idx)
                              + "/" + BattleParam.m_PlayerParty.m_HPMax.getValue((GlobalDefine.PartyCharaIndex)idx)
                              + "</color>";

                    if (BattleParam.IsKobetsuHP)
                    {
                        hp_text += " <color=#a0a0a0>HP" + hp_percent.ToString() + "%\n";
                        if (BattleParam.m_PlayerParty.m_Hate_ProvokeTurn.getValue((GlobalDefine.PartyCharaIndex)idx) > 0)
                        {
                            if (provoke_target == (GlobalDefine.PartyCharaIndex)idx)
                            {
                                hp_text += "[挑発]:";
                            }
                            else
                            {
                                hp_text += "挑発:";
                            }
                            hp_text += BattleParam.m_PlayerParty.m_Hate_ProvokeTurn.getValue((GlobalDefine.PartyCharaIndex)idx);
                        }
                        else
                        {
                            hp_text += "Hate:" + BattleParam.m_PlayerParty.m_Hate.getValue((GlobalDefine.PartyCharaIndex)idx);
                        }

                        hp_text += " ATK" + atk_percent.ToString() + "%</color>";
                    }

                    // スキルターン
                    int skill_turn = chara_once.GetTrunToLimitBreak();
                    MasterDataSkillLimitBreak skill_limit_break = BattleParam.m_MasterDataCache.useSkillLimitBreak(chara_master.skill_limitbreak);
                    if (skill_limit_break != null)
                    {
                        skill_name = skill_turn.ToString() + "/" + skill_limit_break.name;
                    }

                    // ボタンのアクティブ・非アクティブ
                    {
                        is_active_skill_button = is_control && BattleParam.IsEnableLBS((GlobalDefine.PartyCharaIndex)idx);
                    }
                }

                // 表示
                {
                    // キャラ名
                    {
                        Transform chara_name_trans = m_MemberObject[idx].transform.Find("CharaName");
                        if (chara_name_trans != null)
                        {
                            Text text_component = chara_name_trans.GetComponent <Text>();
                            if (text_component != null)
                            {
                                text_component.text = chara_name;
                            }
                        }
                    }
                }

                // スキル発動条件表示
                {
                    {
                        MasterDataDefineLabel.ElementType[,] skill_costs = new MasterDataDefineLabel.ElementType[2, 5];

                        if (is_alive)
                        {
                            MasterDataParamChara chara_master = chara_once.m_CharaMasterDataParam;
                            if (chara_master.skill_active0 != 0)
                            {
                                MasterDataSkillActive skill_active0 = BattleParam.m_MasterDataCache.useSkillActive(chara_master.skill_active0);
                                if (skill_active0 != null)
                                {
                                    skill_costs[0, 0] = skill_active0.cost1;
                                    skill_costs[0, 1] = skill_active0.cost2;
                                    skill_costs[0, 2] = skill_active0.cost3;
                                    skill_costs[0, 3] = skill_active0.cost4;
                                    skill_costs[0, 4] = skill_active0.cost5;
                                }
                            }
                            if (chara_master.skill_active1 != 0)
                            {
                                MasterDataSkillActive skill_active1 = BattleParam.m_MasterDataCache.useSkillActive(chara_master.skill_active1);
                                if (skill_active1 != null)
                                {
                                    skill_costs[1, 0] = skill_active1.cost1;
                                    skill_costs[1, 1] = skill_active1.cost2;
                                    skill_costs[1, 2] = skill_active1.cost3;
                                    skill_costs[1, 3] = skill_active1.cost4;
                                    skill_costs[1, 4] = skill_active1.cost5;
                                }
                            }
                        }

                        for (int skill_idx = 0; skill_idx < 2; skill_idx++)
                        {
                            for (int cost_idx = 0; cost_idx < 5; cost_idx++)
                            {
                                Transform cost_trans = m_MemberObject[idx].transform.Find("SkillInfo/Skill" + skill_idx.ToString() + cost_idx.ToString());
                                if (cost_trans != null)
                                {
                                    MasterDataDefineLabel.ElementType element_type = skill_costs[skill_idx, cost_idx];
                                    if (element_type != MasterDataDefineLabel.ElementType.NONE)
                                    {
                                        Image img = cost_trans.GetComponent <Image>();
                                        if (img != null)
                                        {
                                            img.sprite = m_SkillCostElements[(int)element_type];
                                            cost_trans.gameObject.SetActive(true);
                                        }
                                        else
                                        {
                                            cost_trans.gameObject.SetActive(false);
                                        }
                                    }
                                    else
                                    {
                                        cost_trans.gameObject.SetActive(false);
                                    }
                                }
                            }
                        }
                    }

                    // キャライメージ
                    {
                        Transform chara_image_trans = m_MemberObject[idx].transform.Find("Image");
                        if (chara_image_trans != null)
                        {
                            BattleCharaImageViewControl chara_view_control = chara_image_trans.GetComponent <BattleCharaImageViewControl>();
                            if (chara_view_control != null)
                            {
                                chara_view_control.setCharaID(chara_id, BattleCharaImageViewControl.ImageType.FACE);
                            }
                        }
                    }

                    // リンクキャライメージ
                    {
                        Transform chara_image_trans = m_MemberObject[idx].transform.Find("ImageLink");
                        if (chara_image_trans != null)
                        {
                            BattleCharaImageViewControl chara_view_control = chara_image_trans.GetComponent <BattleCharaImageViewControl>();
                            if (chara_view_control != null)
                            {
                                chara_view_control.setCharaID(link_chara_id, BattleCharaImageViewControl.ImageType.FACE);
                            }
                        }
                    }

                    // キャラ個別HP
                    {
                        Transform chara_hp_trans = m_MemberObject[idx].transform.Find("HP");
                        if (chara_hp_trans != null)
                        {
                            Text text_component = chara_hp_trans.GetComponent <Text>();
                            if (text_component != null)
                            {
                                text_component.text = hp_text;
                            }
                        }

                        if (damage_value != null)
                        {
                            int hp_delta = damage_value.getValue((GlobalDefine.PartyCharaIndex)idx);
                            if (hp_delta > 0)
                            {
                                DrawDamageManager.showDamage(chara_hp_trans, hp_delta, EDAMAGE_TYPE.eDAMAGE_TYPE_WEEK, 50.0f);
                            }
                        }

                        if (heal_value != null)
                        {
                            int hp_delta = heal_value.getValue((GlobalDefine.PartyCharaIndex)idx);
                            if (hp_delta > 0)
                            {
                                DrawDamageManager.showDamage(chara_hp_trans, hp_delta, EDAMAGE_TYPE.eDAMAGE_TYPE_HEAL, 50.0f);
                                EffectManager.Instance.playEffect(SceneObjReferGameMain.Instance.m_EffectPrefab.m_Heal_03, new Vector3(0.01975f, -0.0246875f, 0.0f), Vector3.zero, chara_hp_trans, null, 50.0f * 3.0f);
                            }
                        }
                    }

                    // スキルターン
                    Transform skill_turn_trans = m_MemberObject[idx].transform.Find("SkillButton");
                    if (skill_turn_trans != null)
                    {
                        Text text_component = skill_turn_trans.GetChild(0).GetComponent <Text>();
                        if (text_component != null)
                        {
                            text_component.text = skill_name;
                        }

                        // ボタンのアクティブ・非アクティブ
                        {
                            Button button = skill_turn_trans.GetComponent <Button>();
                            button.interactable = is_active_skill_button;
                        }
                    }
                }

                // 敵にターゲットされているかどうかの表示
                {
                    Transform lock_on_object = m_MemberObject[idx].transform.Find("ImageLockOn");
                    if (lock_on_object != null)
                    {
                        lock_on_object.gameObject.SetActive(BattleParam.m_EnemyToPlayerTarget == (GlobalDefine.PartyCharaIndex)idx);
                    }
                }

                // 状態異常
                if (chara_once != null)
                {
                    Transform ailment_object = m_MemberObject[idx].transform.Find("Ailment");
                    if (ailment_object != null)
                    {
                        InGameAilmentIcon ailment_icon = ailment_object.GetComponent <InGameAilmentIcon>();
                        if (ailment_icon != null)
                        {
                            StatusAilmentChara ailment_info = BattleParam.m_PlayerParty.m_Ailments.getAilment((GlobalDefine.PartyCharaIndex)idx);
                            ailment_icon.SetStatus(ailment_info);   //毎フレーム設定する必要はないがとりあえず設定しておく
                        }
                    }
                }
            }
        }
    }
コード例 #4
0
    //----------------------------------------------------------------------------

    /*!
     *          @brief	Unity固有処理:更新処理	※定期処理
     */
    //----------------------------------------------------------------------------
    void Update()
    {
        //--------------------------------
        // プレイヤー関連ゲージの更新
        // ※パーティ情報に更新があった場合のみ更新
        //--------------------------------
        if (m_PlayerParty != null &&
            m_PlayerParty.m_PartySetupOK == true &&
            SceneModeContinuousBattle.Instance.m_InGameBattleInitOK == true &&
            BattleParam.m_PlayerParty != null)
        {
            int total_hands = 0;
            // 保存しているSPと現在値が異なっている場合、SP表示更新。
            if (m_PartyTotalSPPrv != m_PlayerParty.m_PartyTotalSP &&
                BattleSkillCutinManager.Instance != null &&
                BattleSkillCutinManager.Instance.isRunning() == false)
            {
                m_PartyTotalSPPrv = m_PlayerParty.m_PartyTotalSP;

                m_InGamePartyManager.setGaugeSp(m_PartyTotalSPPrv);
            }
            // 総Hands数
            if (m_HandsView == true)
            {
                for (int i = 0; i < (int)GlobalDefine.PartyCharaIndex.MAX; i++)
                {
                    if (InGamePlayerParty.m_PlayerPartyChara[i] != null &&
                        InGamePlayerParty.m_PlayerPartyChara[i].m_CharaMasterDataParam != null)
                    {
                        total_hands += BattleParam.getPartyMemberHands((GlobalDefine.PartyCharaIndex)i);
                    }
                }
                if (m_PartyTotalHandsPrv != total_hands)
                {
                    if (m_PartyTotalHandsPrv < 0 && total_hands == 0)
                    {
                    }
                    else
                    {
                        m_PartyTotalHandsPrv = total_hands;
                        m_InGamePartyManager.setTotalHands(m_PartyTotalHandsPrv);
                    }
                }
            }
            else
            {
                m_PartyTotalHandsPrv = -1;
                if (m_InGamePartyManager.Total_hands_active == true)
                {
                    m_InGamePartyManager.setTotalHands(-1);
                }
            }
            if (BattleParam.m_PlayerParty.m_BattleHero != null &&
                m_HeroTotalSkillPrv != BattleParam.m_PlayerParty.m_BattleHero.getSkillTurn())
            {
                m_HeroTotalSkillPrv = BattleParam.m_PlayerParty.m_BattleHero.getSkillTurn();


                //----------------------------------------
                // スキルターン数に合わせてUIのゲージ更新
                //----------------------------------------
                float rate = 0;
                if (BattleParam.m_PlayerParty.m_BattleHero.getSkillTurnMax() != 0)
                {
                    rate = 1 - ((float)m_HeroTotalSkillPrv / (float)BattleParam.m_PlayerParty.m_BattleHero.getSkillTurnMax());
                }
                m_HeroGauge.fillAmount = rate;
                if (BattleParam.m_PlayerParty.m_BattleHero.checkHeroSkillTurn() == false)
                {
                    m_InGamePartyManager.Hero_balloon_text    = string.Format(GameTextUtil.GetText("hero_skill_hands_battle"), m_HeroTotalSkillPrv);
                    m_InGamePartyManager.Hero_balloon2_active = false;
                    if (m_InfoOpen == true &&
                        m_InGamePartyManager.Hero_balloon1_active == false)
                    {
                        m_InGamePartyManager.Hero_balloon1_active = true;
                    }
                }
                else
                {
                    m_InGamePartyManager.Hero_balloon2_active = true;
                    m_InGamePartyManager.Hero_balloon1_active = false;
                    if (BattleSceneUtil.checkLimitBreak(BattleParam.m_PlayerParty, GlobalDefine.PartyCharaIndex.HERO, BattleParam.m_EnemyParam, BattleParam.m_TargetEnemyCurrent) == false)
                    {
                        m_InGamePartyManager.Hero_balloon2_color = Balloon_gray;
                    }
                    else
                    {
                        m_InGamePartyManager.Hero_balloon2_color = Color.white;
                    }
                }
            }
        }

        if (InGameQuestData.Instance != null)
        {
            //----------------------------------------
            // 金額総数を表示
            //----------------------------------------
            if (m_CoinNum != InGameQuestData.Instance.GetAcquireMoneyTotal())
            {
                m_CoinNum = InGameQuestData.Instance.GetAcquireMoneyTotal();
                m_InGamePartyManager.Coin_num = m_CoinNum.ToString();
            }
            //----------------------------------------
            // 取得チケット数を表示
            //----------------------------------------
            if (m_TicketNum != InGameQuestData.Instance.GetAcquireTicketTotal())
            {
                m_TicketNum = InGameQuestData.Instance.GetAcquireTicketTotal();
                m_InGamePartyManager.Ticket_num = m_TicketNum.ToString();
            }
            //----------------------------------------
            // 取得ユニット数数を表示
            //----------------------------------------
            if (m_UnitNum != InGameQuestData.Instance.GetAcquireUnitTotal())
            {
                m_UnitNum = InGameQuestData.Instance.GetAcquireUnitTotal();
                m_InGamePartyManager.Unit_num = m_UnitNum.ToString();
            }
        }

        // 「Ready」アニメーション制御
        if (m_InGamePartyManager.Hero_balloon2_active &&
            (InGameMenuManagerQuest2.Instance != null && InGameMenuManagerQuest2.Instance.isSkillMenuActive == false))
        {
            bool animStop = false;
            if (BattleParam.getBattlePhase() == BattleParam.BattlePhase.INPUT_HANDLING ||
                BattleParam.isCountDown()
                )
            {
                // プレイヤー操作中・カウントダウン中はアニメーションしない。「Ready」表示状態で止める。
                animStop = true;
            }
            setReadyAnimation(animStop);
        }
    }
コード例 #5
0
    void Update()
    {
        // 画面位置調整(アスペクト比)
        if (m_BattleLogic.m_InitialPhase >= BattleLogic.InitialPhase.QUEST_INIT)
        {
            adjustScreen();
        }

        if (m_TopRightAnchor != null)
        {
            if (SafeAreaControl.HasInstance)
            {
                RectTransform rect_transform = m_TopRightAnchor.GetComponent <RectTransform>();
                if (rect_transform != null)
                {
                    rect_transform.anchoredPosition = new Vector2(320.0f, -SafeAreaControl.Instance.bar_height);
                }
            }
        }

        // チュートリアル更新
        m_BattleTutorialManager.updateTutorial(Time.deltaTime);

        // オートプレイ
        m_BattleAutoPlay.update(Time.deltaTime);

        // タッチ乗っ取り時の手の表示
        _updateOverrideTouchHand();

        // パーティHP表示更新
        if (BattleParam.m_PlayerParty != null)
        {
            BattleParam.m_PlayerParty.updateDispHp(Time.deltaTime);
        }

        switch (m_BattleScenePhase)
        {
        case BattleScenePhase.NOT_BATTLE:
        {
            if (m_IsChangeBattleScenePhase)
            {
                m_IsChangeBattleScenePhase = false;
            }

            // 手札エリアはオブジェクトの初期化が完了したら表示できる.
            bool is_show_hand_area = m_IsShowHandArea && m_BattleLogic.m_InitialPhase >= BattleLogic.InitialPhase.QUEST_INIT;
            m_PartsGroup1.SetActive(is_show_hand_area);
            m_PartsGroup2.SetActive(false);
        }
            return;

        //break;

        case BattleScenePhase.IN_BATTLE:
            if (m_IsChangeBattleScenePhase)
            {
                m_IsChangeBattleScenePhase = false;
            }

            m_PartsGroup1.SetActive(true);
            m_PartsGroup2.SetActive(true);
            break;
        }

        if (gameObject.IsActive())
        {
            // エネミー詳細ウィンドウの制御
            if (BattleParam.m_TargetEnemyWindow != InGameDefine.SELECT_NONE)
            {
                if (m_IsShowEnemyDetailWindow == false)
                {
                    m_IsShowEnemyDetailWindow = true;
                    if (m_EnemyDetailWindowObject == null)
                    {
                        if (m_EnemyDetailWindowPrefab != null)
                        {
                            m_EnemyDetailWindowObject = GameObject.Instantiate(m_EnemyDetailWindowPrefab);
                            BattleSceneUtil.setRide(m_EnemyDetailWindowObject.transform, SceneObjReferGameMain.Instance.m_UIInstanceTargetWindowPosition.transform);
                        }
                    }

                    if (m_EnemyDetailWindowObject != null)
                    {
                        m_EnemyDetailWindowObject.SetActive(true);
                    }
                }
                else
                {
                    if (m_EnemyDetailWindowObject == null || m_EnemyDetailWindowObject.IsNullOrInactive())
                    {
                        BattleParam.m_TargetEnemyWindow = InGameDefine.SELECT_NONE;
                        m_IsShowEnemyDetailWindow       = false;
                        m_EnemyDetailWindowObject       = null;
                    }
                }
            }


            // スキル成立時プレイヤーへ向かって飛んでいくエフェクト
            MasterDataDefineLabel.ElementType[,] elements = m_BattleLogic.m_SkillIconArea.getNewSkillElementInfo();
            if (elements != null)
            {
                for (int field_idx = 0; field_idx < elements.GetLength(0); field_idx++)
                {
                    for (int idx = 0; idx < (int)GlobalDefine.PartyCharaIndex.MAX; idx++)
                    {
                        MasterDataDefineLabel.ElementType element = elements[field_idx, idx];
                        if (element != MasterDataDefineLabel.ElementType.NONE)
                        {
                            Transform  start_trans = m_BattleCardArea.GetComponent <BattleCardArea>().getEffectPosition(field_idx, BattleScene._BattleCardManager.EffectInfo.EffectPosition.FIELD_AREA);
                            Transform  goal_trans  = m_BattleLogic.m_BattlePlayerPartyViewControl.getEffectTransform((GlobalDefine.PartyCharaIndex)idx);
                            GameObject effect_obj  = EffectManager.Instance.playEffect(SceneObjReferGameMain.Instance.m_EffectPrefab.m_SkillSetupNaught, Vector3.zero, Vector3.zero, start_trans, null);

                            if (effect_obj != null)
                            {
                                effect_obj.transform.tweenToParent(goal_trans, 0.3f);
                            }
                        }
                    }
                }
            }
            m_BattleLogic.m_SkillIconArea.clearNewSkillElementInfo();
        }

        // ユーザー操作可能になってからの経過フレーム数
        {
            BattleParam.BattlePhase phase = BattleParam.getBattlePhase();
            if (phase == BattleParam.BattlePhase.INPUT ||
                phase == BattleParam.BattlePhase.INPUT_HANDLING
                )
            {
                m_InputEnableFrameCounter++;
            }
            else
            {
                m_InputEnableFrameCounter = 0;
            }
        }

        // 手札領域を暗くするマスクのオンオフ
        if (m_InputEnableFrameCounter >= 2)
        {
            m_CardMask.SetActive(false);
        }
        else
        {
            m_CardMask.SetActive(true);
        }

        // パーティUIの拡縮に応じたマスクコリジョンの制御
        {
            float offset_y = 0.0f;
            if (BattleParam.IsKobetsuHP)
            {
                if (BattleParam.isShowPartyInterfaceSkillCost())
                {
                    offset_y += 0.1f;
                }
                if (BattleParam.isShowPartyInterfaceSkillTurn())
                {
                    offset_y += 0.1f;
                }
            }
            m_UIMask.transform.localPosition = new Vector3(0.0f, offset_y, 0.0f);
        }

        // ガイド表示
        if (m_GuideDispTransform != null)
        {
            LocalSaveOption cOption = LocalSaveManager.Instance.LoadFuncOption();
            if (cOption != null)
            {
                bool is_change = false;
                if (m_InputEnableFrameCounter >= 2)
                {
                    if (m_GuideDispMode != cOption.m_OptionGuide)
                    {
                        is_change       = true;
                        m_GuideDispMode = cOption.m_OptionGuide;
                    }
                }
                else
                {
                    if (m_GuideDispMode != -1)
                    {
                        is_change       = true;
                        m_GuideDispMode = -1;
                    }
                }

                if (is_change)
                {
                    m_GuideDispTransform.gameObject.SetActive(m_GuideDispMode > 0);
                }
            }
        }
    }