Esempio n. 1
0
        public CmpClothes GetCustomClothesComponent(int parts)
        {
            if (this.cmpClothes == null)
            {
                return((CmpClothes)null);
            }
            if (parts >= this.cmpClothes.Length)
            {
                return((CmpClothes)null);
            }
            CmpClothes cmpClothe = this.cmpClothes[parts];

            return(Object.op_Equality((Object)null, (Object)cmpClothe) ? (CmpClothes)null : cmpClothe);
        }
Esempio n. 2
0
    public static void InitializeClothes(GameObject selectedObject)
    {
        GameObject clotheObject = selectedObject;

        clotheObject.layer = 10;

        if (clotheObject != null)
        {
            AIChara.CmpClothes clotheComponent = clotheObject.GetComponent <AIChara.CmpClothes>();
            if (clotheComponent == null)
            {
                clotheComponent = clotheObject.AddComponent <AIChara.CmpClothes>();
            }

            FindAssist findAssist = new FindAssist();
            findAssist.Initialize(clotheComponent.transform);
            clotheComponent.objTopDef = findAssist.GetObjectFromName("n_top_a");
            if (clotheComponent.objTopDef == null)
            {
                clotheComponent.objTopDef = findAssist.GetObjectFromName("top_00_a");
            }
            clotheComponent.objTopHalf = findAssist.GetObjectFromName("n_top_b");
            if (clotheComponent.objTopHalf == null)
            {
                clotheComponent.objTopHalf = findAssist.GetObjectFromName("top_00_b");
            }
            clotheComponent.objBotDef = findAssist.GetObjectFromName("n_bot_a");
            if (clotheComponent.objBotDef == null)
            {
                clotheComponent.objBotDef = findAssist.GetObjectFromName("bot_00_a");
            }
            clotheComponent.objBotHalf = findAssist.GetObjectFromName("n_bot_b");
            if (clotheComponent.objBotHalf == null)
            {
                clotheComponent.objBotHalf = findAssist.GetObjectFromName("bot_00_b");
            }


            clotheComponent.objOpt01 = (from x in findAssist.dictObjName
                                        where x.Key.StartsWith("op1")
                                        select x.Value).ToArray();
            clotheComponent.objOpt02 = (from x in findAssist.dictObjName
                                        where x.Key.StartsWith("op2")
                                        select x.Value).ToArray();

            // remove all dynamic bones. smh...
            DynamicBone[] components = clotheComponent.GetComponents <DynamicBone>();
            foreach (var comp in components)
            {
                Object.DestroyImmediate(comp);
            }

            Regex rgx      = new Regex(@"^cf_J_Legsk_[0-9]{2}_00$"); // f**k off _dam bones
            var   dynBones = (from x in findAssist.dictObjName where rgx.IsMatch(x.Value.transform.name) select x.Value).ToArray();
            foreach (GameObject bone in dynBones)
            {
                DynamicBone dynBone = clotheObject.AddComponent <DynamicBone>();
                dynBone.m_Root           = bone.transform;
                dynBone.m_UpdateRate     = 60;
                dynBone.m_UpdateMode     = DynamicBone.UpdateMode.AnimatePhysics;
                dynBone.m_Damping        = 0.430f;
                dynBone.m_DampingDistrib = new AnimationCurve();
                dynBone.m_DampingDistrib.AddKey(1f, 0.3f);
                dynBone.m_DampingDistrib.AddKey(0f, 0.4f);
                dynBone.m_Elasticity    = 0.038f;
                dynBone.m_Stiffness     = 0.669f;
                dynBone.m_Inert         = 0.244f;
                dynBone.m_Radius        = 0.2f;
                dynBone.m_RadiusDistrib = new AnimationCurve();
                dynBone.m_RadiusDistrib.AddKey(0f, 1f);
                dynBone.m_RadiusDistrib.AddKey(1f, 1.5f);
                dynBone.m_EndLength = 0f;
                dynBone.m_Force     = new Vector3(0, -0.0025f, 0);
            }

            Regex rgx2      = new Regex(@"^cf_J_sk_[0-9]{2}_00$"); // f**k you _dam bones
            var   dynBones2 = (from x in findAssist.dictObjName where rgx2.IsMatch(x.Value.transform.name) select x.Value).ToArray();
            foreach (GameObject bone in dynBones2)
            {
                DynamicBone dynBone = clotheObject.AddComponent <DynamicBone>();
                dynBone.m_Root           = bone.transform;
                dynBone.m_UpdateRate     = 60;
                dynBone.m_UpdateMode     = DynamicBone.UpdateMode.AnimatePhysics;
                dynBone.m_Damping        = 0.430f;
                dynBone.m_DampingDistrib = new AnimationCurve();
                dynBone.m_DampingDistrib.AddKey(1f, 0.3f);
                dynBone.m_DampingDistrib.AddKey(0f, 0.4f);
                dynBone.m_Elasticity    = 0.038f;
                dynBone.m_Stiffness     = 0.669f;
                dynBone.m_Inert         = 0.244f;
                dynBone.m_Radius        = 0.2f;
                dynBone.m_RadiusDistrib = new AnimationCurve();
                dynBone.m_RadiusDistrib.AddKey(0f, 1f);
                dynBone.m_RadiusDistrib.AddKey(1f, 1.5f);
                dynBone.m_EndLength = 0f;
                dynBone.m_Force     = new Vector3(0, -0.0025f, 0);
            }

            Renderer[] renderers = clotheObject.GetComponentsInChildren <Renderer>();
            clotheComponent.rendCheckVisible = new Renderer[renderers.Length];
            clotheComponent.rendNormal01     = new Renderer[renderers.Length];
            for (int i = 0; i < renderers.Length; i++)
            {
                renderers[i].gameObject.layer       = 10;
                clotheComponent.useColorN01         = true;
                clotheComponent.rendCheckVisible[i] = renderers[i];
                clotheComponent.rendNormal01[i]     = renderers[i];
            }
        }
    }