예제 #1
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;
    }