コード例 #1
0
        public static bool ApplyParamBust(ParamBustCustom source, DynamicBone_Ver02 target)
        {
            Regex regex = new Regex("_R$");

            //For Params
            //Parameter Patterns[0]="通常"
            target.setGravity(0, new UnityEngine.Vector3(0, source.gravity, 0));

            for (int i = 0; i < target.Patterns[0].Params.Count; i++)
            {
                string boneName = regex.Replace(target.Patterns[0].Params[i].Name, "_L");
                if (source.paramBones.ContainsKey(boneName))
                {
                    ParamBone parameterSet = source.paramBones[boneName];
                    if (parameterSet != null)
                    {
                        parameterSet.CopyParameterTo(target.Patterns[0].Params[i]);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }

            //For ParticlePtn
            //ParticlePtn Patterns[0]="通常"
            CopyParamsToParticlePtn(target);

            //For Particle. Must set at last.
            target.setPtn(0, true);

            return(true);
        }
コード例 #2
0
        public void CopyParamFrom(DynamicBone_Ver02 target)
        {
            gravity.Set(target.Gravity.x, target.Gravity.y, target.Gravity.z);
            parameters = new ParamBone[target.Patterns[0].Params.Count()];
            for (int i = 0; i < parameters.Count(); i++)
            {
                ParamBone param = new ParamBone("");
                param.IsRotationCalc = target.Patterns[0].Params[i].IsRotationCalc;
                param.Damping        = target.Patterns[0].Params[i].Damping;
                param.Elasticity     = target.Patterns[0].Params[i].Elasticity;
                param.Stiffness      = target.Patterns[0].Params[i].Stiffness;
                param.Inert          = target.Patterns[0].Params[i].Inert;
                parameters[i]        = param;
            }


            particles = new ParamBone[target.Patterns[0].ParticlePtns.Count()];
            for (int i = 0; i < particles.Count(); i++)
            {
                particles[i] = new ParamBone("");
                particles[i].IsRotationCalc = target.Patterns[0].ParticlePtns[i].IsRotationCalc;
                particles[i].Damping        = target.Patterns[0].ParticlePtns[i].Damping;
                particles[i].Elasticity     = target.Patterns[0].ParticlePtns[i].Elasticity;
                particles[i].Stiffness      = target.Patterns[0].ParticlePtns[i].Stiffness;
                particles[i].Inert          = target.Patterns[0].ParticlePtns[i].Inert;
            }
        }
コード例 #3
0
 public void CopyParameterTo(ParamBone target)
 {
     target.IsRotationCalc = IsRotationCalc;
     target.Damping        = Damping;
     target.Elasticity     = Elasticity;
     target.Stiffness      = Stiffness;
     target.Inert          = Inert;
 }
コード例 #4
0
 public bool CopyParameterFrom(ParamBone paramBone)
 {
     try
     {
         IsRotationCalc = paramBone.IsRotationCalc;
         Damping        = paramBone.Damping;
         Elasticity     = paramBone.Elasticity;
         Stiffness      = paramBone.Stiffness;
         Inert          = paramBone.Inert;
     }
     catch (Exception e)
     {
         BreastPhysicsController.Logger.Log(BepInEx.Logging.LogLevel.Warning, "Failed copy DynamicBoneParam to XMLParamSet.");
         return(false);
     }
     return(true);
 }
コード例 #5
0
 public bool CopyParameterFrom(ParamBone paramBone)
 {
     try
     {
         IsRotationCalc = paramBone.IsRotationCalc;
         Damping        = paramBone.Damping;
         Elasticity     = paramBone.Elasticity;
         Stiffness      = paramBone.Stiffness;
         Inert          = paramBone.Inert;
         return(true);
     }
     catch (Exception e)
     {
         BreastPhysicsController.Logger.LogError("Failed copy DynamicBoneParam.");
         return(false);
     }
 }
コード例 #6
0
        public void CopyParamFrom(DynamicBone_Ver02 target)
        {
            gravity.Set(target.Gravity.x, target.Gravity.y, target.Gravity.z);
            parameters = new ParamBone[target.Patterns[0].Params.Count()];
            for (int i = 0; i < parameters.Count(); i++)
            {
                parameters[i] = new ParamBone("");
                parameters[i].IsRotationCalc = target.Patterns[0].Params[i].IsRotationCalc;
                parameters[i].Damping        = target.Patterns[0].Params[i].Damping;
                parameters[i].Elasticity     = target.Patterns[0].Params[i].Elasticity;
                parameters[i].Stiffness      = target.Patterns[0].Params[i].Stiffness;
                parameters[i].Inert          = target.Patterns[0].Params[i].Inert;
            }
            particlesPtn = new ParamBone[target.Patterns[0].ParticlePtns.Count()];
            for (int i = 0; i < particlesPtn.Count(); i++)
            {
                particlesPtn[i] = new ParamBone("");
                particlesPtn[i].IsRotationCalc = target.Patterns[0].ParticlePtns[i].IsRotationCalc;
                particlesPtn[i].Damping        = target.Patterns[0].ParticlePtns[i].Damping;
                particlesPtn[i].Elasticity     = target.Patterns[0].ParticlePtns[i].Elasticity;
                particlesPtn[i].Stiffness      = target.Patterns[0].ParticlePtns[i].Stiffness;
                particlesPtn[i].Inert          = target.Patterns[0].ParticlePtns[i].Inert;
            }

            FieldInfo fieldInfo = target.GetType().GetField("Particles", BindingFlags.Instance | BindingFlags.NonPublic);
            List <DynamicBone_Ver02.Particle> srcParticles = fieldInfo.GetValue(target) as List <DynamicBone_Ver02.Particle>;

            particles = new ParamBone[srcParticles.Count()];
            for (int i = 0; i < particles.Count(); i++)
            {
                particles[i] = new ParamBone("");
                particles[i].IsRotationCalc = srcParticles[i].IsRotationCalc;
                particles[i].Damping        = srcParticles[i].Damping;
                particles[i].Elasticity     = srcParticles[i].Elasticity;
                particles[i].Stiffness      = srcParticles[i].Stiffness;
                particles[i].Inert          = srcParticles[i].Inert;
            }
        }