Ejemplo n.º 1
0
    public override void Refresh()
    {
        base.Refresh();

        if (!gameObject.activeSelf)
        {
            return;
        }

        EquipmentItem firstequip = null;

        for (int i = 0; i < m_EquipmentSlotUI.Length; ++i)
        {
            EquipmentItem item = InventoryManager.Instance.GetEquippedItem(i);
            if (item != null && item.GetWeaponModel() != null && firstequip == null)
            {
                firstequip = item;
            }
            m_EquipmentSlotUI[i].SetData(item);
        }

        m_CharacterSlotUI.SetData(InventoryManager.Instance.GetEquipmentCharacterData());
        string     modelname = InventoryManager.Instance.GetPlayerModelName();
        GameObject model     = Instantiate(Resources.Load <GameObject>(modelname + "/" + modelname), Vector3.zero, Quaternion.identity);

        m_CharacterPreviewUI.SetPreviewModel(model);
        if (firstequip)
        {
            m_CharacterPreviewUI.SetPerviewWeapon(firstequip.GetWeaponModel().name, firstequip.GetWeaponType());
        }
        else
        {
            m_CharacterPreviewUI.SetPerviewWeapon("", E_WEAPONTYPE.PUNCH);
        }
    }
Ejemplo n.º 2
0
    IEnumerator C_Initialize()
    {
        Main main = null;

        while (main == null)
        {
            main = GameManager.Instance.m_Main;
            yield return(null);
        }

        while (!main.IsBeginLoadingComplete)
        {
            yield return(null);
        }

        main.AddPlayerCharacter(this);

        while (!m_IsInitializeComplete)
        {
            yield return(null);
        }

        Material mat = null;

        if (m_PhotonView.IsMine)
        {
            mat = ((Main_Stage)GameManager.Instance.m_Main).m_LocalOutLineMaterial;
        }
        else
        {
            mat = ((Main_Stage)GameManager.Instance.m_Main).m_OtherOutLineMaterial;
        }
        SkinnedMeshRenderer[] renderers = m_Animator.GetComponentsInChildren <SkinnedMeshRenderer>();
        for (int i = 0; i < renderers.Length; ++i)
        {
            Material[] newmat = new Material[renderers[i].materials.Length + 1];
            for (int j = 0; j < renderers[i].materials.Length; ++j)
            {
                newmat[j] = renderers[i].materials[j];
            }
            newmat[newmat.Length - 1] = mat;
            renderers[i].materials    = newmat;
        }

        if (m_PhotonView.IsMine)
        {
            bool attachweapon = false;
            for (int i = 0; i < 3; ++i)
            {
                EquipmentItem item = InventoryManager.Instance.GetEquippedItem(i);
                if (item)
                {
                    GameObject weapon = item.GetWeaponModel();
                    if (weapon)
                    {
                        attachweapon = true;
                        m_AttackType = item.m_ItemElement;
                        AttachWeapon(weapon.name, item.GetWeaponType());
                        break;
                    }
                }
            }

            if (!attachweapon)
            {
                AttachWeapon("", E_WEAPONTYPE.PUNCH);
            }

            for (int i = 0; i < 3; ++i)
            {
                EquipmentItem item = InventoryManager.Instance.GetEquippedItem(i);
                if (item)
                {
                    item.EquipAction(this);
                    ActiveSkill sk = item.GetActiveSkill();
                    if (sk)
                    {
                        sk.Initialize(this, true);
                    }

                    List <PassiveSkill> list = item.GetPassiveSkills();
                    if (list != null)
                    {
                        for (int j = 0; j < list.Count; ++j)
                        {
                            list[j].Initialize(this, true);
                        }
                    }
                }
            }
            NetworkManager.Instance.RoomController.SetLocalPlayerProperties(m_CharacterReadyKey, true);
        }
        m_IsPlayerCharacterInitializeComplete = true;
    }