Esempio n. 1
0
    // Use this for initialization
    void Start()
    {
        for (int idx = 0; idx < m_CutinObjects.Length; idx++)
        {
            m_CutinObjects[idx] = new CutinObjectInfo(m_BgObjectPrefab, transform, this);
        }

        m_SkillAreaTransform = transform.Find("SkillArea");

        for (int obj_idx = 0; obj_idx < m_SkillObjects.Length; obj_idx++)
        {
            GameObject skill_object = Instantiate(m_SkillObjectPrefab);
            m_SkillObjects[obj_idx] = skill_object;

            skill_object.transform.SetParent(m_SkillLocateCurrent.transform, false);

            // キャラアイコンを設定
            for (int member_idx = 0; member_idx < BattleParam.m_PlayerParty.getPartyMemberMaxCount(); member_idx++)
            {
                CharaOnce chara_once = BattleParam.m_PlayerParty.getPartyMember((GlobalDefine.PartyCharaIndex)member_idx, CharaParty.CharaCondition.EXIST);
                if (chara_once != null)
                {
                    Transform unit_obj = skill_object.transform.Find("Unit" + member_idx.ToString());
                    if (unit_obj != null &&
                        unit_obj.childCount > 0
                        )
                    {
                        Transform unit_obj_child = unit_obj.GetChild(0);
                        if (unit_obj_child != null)
                        {
                            Image unit_image = unit_obj_child.GetComponent <Image>();

                            if (unit_image != null)
                            {
                                UnitIconImageProvider.Instance.Get(
                                    chara_once.m_CharaMasterDataParam.fix_id,
                                    sprite =>
                                {
                                    unit_image.sprite = sprite;
                                });
                            }
                        }
                    }
                }
            }

            skill_object.SetActive(false);
        }

        m_ResurrectUnitPos0 = m_SkillObjects[0].transform.Find("Unit0").localPosition;
        m_ResurrectUnitPos1 = m_SkillObjects[0].transform.Find("Unit1").localPosition;
    }
Esempio n. 2
0
    // Update is called once per frame
    void Update()
    {
        if (m_UpdateMode == UpdateMode.NONE)
        {
            return;
        }

        m_AnimSpeed = (m_IsSpeedUp) ? 1.75f : 1.0f;
        LocalSaveOption cOption = LocalSaveManager.Instance.LoadFuncOption();

        if (cOption != null)
        {
            m_AnimSpeed *= (cOption.m_OptionSpeed != 0) ? 1.0f : 0.6f;
        }

        float delta_time = Time.deltaTime;

        for (int idx = 0; idx < m_CutinObjects.Length; idx++)
        {
            m_CutinObjects[idx].update(delta_time);
        }

        if (m_DisappearCutinObjectInfo != null)
        {
            if (m_DisappearCutinObjectInfo.getPhase() != CutinObjectInfo.Phase.DISSPPEAR)
            {
                m_DisappearCutinObjectInfo = null;
            }
        }

        if (m_CurrentCutinObjectInfo != null && m_CurrentCutinObjectInfo.getPhase() == CutinObjectInfo.Phase.APPEAR)
        {
            // スキル表示物を下地のスケールに合わせる(キャラ出現時用)
            m_SkillAreaTransform.localScale = m_CurrentCutinObjectInfo.m_BGTransform.localScale;
            return;
        }
        m_SkillAreaTransform.localScale = Vector3.one;

        updateSkillAnim(delta_time);

        if (m_UpdateMode != UpdateMode.STEP_WAIT && m_SkillTime <= 0.0f)
        {
            // 割り込みスキル
            if (m_ResurrectInfo != null)
            {
                m_SkillInfos.Insert(0, m_ResurrectInfo);
                m_ResurrectInfo = null;
            }

            // アニメーションしていないので次のスキルへ
            if (m_IsNoCutinMode == false)
            {
                if (m_SkillInfos.Count > 0)
                {
                    int old_key = -1;

                    if (m_CurrentSkillInfo != null)
                    {
                        old_key = m_CurrentSkillInfo.m_Key;
                    }

                    m_CurrentSkillInfo = m_SkillInfos[0];
                    m_SkillInfos.RemoveAt(0);

                    if (old_key != m_CurrentSkillInfo.m_Key)
                    {
                        int caster_chara_id = 0;
                        MasterDataDefineLabel.ElementType skill_element = m_CurrentSkillInfo.m_SkillElement;
                        if (m_CurrentSkillInfo.m_Caster == GlobalDefine.PartyCharaIndex.HERO)
                        {
                            caster_chara_id = 0;
                            if (UserDataAdmin.HasInstance)
                            {
                                ServerDataDefine.PacketStructHero current_hero = UserDataAdmin.Instance.getCurrentHero();
                                if (current_hero != null)
                                {
                                    MasterDataHero master_data_hero = MasterFinder <MasterDataHero> .Instance.Find(current_hero.hero_id);

                                    if (master_data_hero != null)
                                    {
                                        caster_chara_id = -current_hero.hero_id;
                                        if (skill_element == MasterDataDefineLabel.ElementType.NONE)
                                        {
                                            skill_element = master_data_hero.getElement();
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            CharaOnce chara_once = BattleParam.m_PlayerParty.getPartyMember(m_CurrentSkillInfo.m_Caster, CharaParty.CharaCondition.EXIST);
                            if (chara_once != null)
                            {
                                MasterDataParamChara chara_master = chara_once.m_CharaMasterDataParam;

                                if ((m_CurrentSkillInfo.m_SkillType == ESKILLTYPE.eLINK || m_CurrentSkillInfo.m_SkillType == ESKILLTYPE.eLINKPASSIVE) &&
                                    chara_once.m_LinkParam != null
                                    )
                                {
                                    MasterDataParamChara link_chara_master = chara_once.m_LinkParam.m_cCharaMasterDataParam;
                                    if (link_chara_master != null)
                                    {
                                        chara_master = link_chara_master;
                                    }
                                }

                                caster_chara_id = (int)chara_master.fix_id;
                                if (skill_element == MasterDataDefineLabel.ElementType.NONE)
                                {
                                    skill_element = chara_master.element;
                                }
                            }
                        }

                        if (m_CurrentCutinObjectInfo != null)
                        {
                            m_DisappearCutinObjectInfo = m_CurrentCutinObjectInfo;
                            m_CurrentCutinObjectInfo   = null;
                            m_DisappearCutinObjectInfo.animDisappear();
                        }

                        if (m_DisappearCutinObjectInfo != m_CutinObjects[0])
                        {
                            m_CurrentCutinObjectInfo = m_CutinObjects[0];
                            m_CutinObjects[1].m_RootObject.transform.SetSiblingIndex(0);
                            m_CutinObjects[0].m_RootObject.transform.SetSiblingIndex(1);
                        }
                        else
                        {
                            m_CurrentCutinObjectInfo = m_CutinObjects[1];
                            m_CutinObjects[0].m_RootObject.transform.SetSiblingIndex(0);
                            m_CutinObjects[1].m_RootObject.transform.SetSiblingIndex(1);
                        }

                        m_CurrentCutinObjectInfo.initAnim(caster_chara_id, m_BgImages[(int)skill_element], m_IsEnableCharaImage);
                        m_CurrentCutinObjectInfo.animAppear();

                        // キャラ出現時用のスキル表示物を設定
                        //if (m_CurrentSkillInfo != null)
                        {
                            m_SkillObjects[0].SetActive(false);

                            setupSkillPanel(m_SkillObjects[1], m_CurrentSkillInfo, m_SkillLocateNext1.transform);
                            m_SkillObjects[1].SetActive(true);

                            if (m_SkillInfos.Count >= 1 && m_CurrentSkillInfo.m_Key == m_SkillInfos[0].m_Key)
                            {
                                setupSkillPanel(m_SkillObjects[2], m_SkillInfos[0], m_SkillLocateNext2.transform);
                                m_SkillObjects[2].SetActive(true);
                            }
                            else
                            {
                                m_SkillObjects[2].SetActive(false);
                            }
                        }

                        m_SkillAreaTransform.localScale = new Vector3(1.0f, 0.0f, 1.0f);
                    }
                    else
                    {
                        if (m_CurrentCutinObjectInfo != null &&
                            m_CurrentSkillInfo != null &&
                            m_CurrentSkillInfo.m_SkillElement != MasterDataDefineLabel.ElementType.NONE
                            )
                        {
                            Sprite bg_elem_sprite = m_BgImages[(int)m_CurrentSkillInfo.m_SkillElement];
                            m_CurrentCutinObjectInfo.startChangeElementAnimation(bg_elem_sprite, CutinObjectInfo.ANIM_TIME_SKILL * 0.25f / m_AnimSpeed);
                        }
                    }

                    startSkillAnim();
                }
                else
                {
                    if (m_ResurrectInfo == null)
                    {
                        m_CurrentSkillInfo = null;
                        if (m_CurrentCutinObjectInfo != null)
                        {
                            // キャラの消滅アニメ開始
                            m_DisappearCutinObjectInfo = m_CurrentCutinObjectInfo;
                            m_CurrentCutinObjectInfo   = null;
                            m_DisappearCutinObjectInfo.animDisappear();
                            m_UpdateMode = UpdateMode.AUTO;
                        }
                        else
                        {
                            // すべて終了
                            if (m_DisappearCutinObjectInfo == null)
                            {
                                m_UpdateMode = UpdateMode.NONE;
                            }
                        }
                    }
                }
            }
            else
            {
                if (m_SkillInfos.Count > 0)
                {
                    m_CurrentSkillInfo = m_SkillInfos[0];
                    m_SkillInfos.RemoveAt(0);
                    startSkillAnim();
                }
                else
                {
                    m_CurrentSkillInfo = null;
                    m_UpdateMode       = UpdateMode.NONE;
                }
            }
        }
    }