Ejemplo n.º 1
0
        public static void Inherit(SimDescription child, SimDescription dad, SimDescription mom)
        {
            VoiceVariationType voice = VoiceVariationType.B;

            if (RandomUtil.CoinFlip())
            {
                if (dad != null)
                {
                    voice = dad.VoiceVariation;
                }
                else if (mom != null)
                {
                    voice = mom.VoiceVariation;
                }
                else
                {
                    voice = unchecked ((VoiceVariationType)RandomUtil.GetInt(0, 2));
                }
            }
            else
            {
                if (mom != null)
                {
                    voice = mom.VoiceVariation;
                }
                else if (dad != null)
                {
                    voice = dad.VoiceVariation;
                }
                else
                {
                    voice = unchecked ((VoiceVariationType)RandomUtil.GetInt(0, 2));
                }
            }

            child.VoiceVariation = voice;

            if (child.IsMale)
            {
                if (dad != null)
                {
                    child.VoicePitchModifier = dad.VoicePitchModifier;
                }
                else
                {
                    child.VoicePitchModifier = RandomUtil.GetFloat(0f, 0.6f);
                }
            }
            else
            {
                if (mom != null)
                {
                    child.VoicePitchModifier = mom.VoicePitchModifier;
                }
                else
                {
                    child.VoicePitchModifier = RandomUtil.GetFloat(0.4f, 1f);
                }
            }

            float fMutation = RandomUtil.GetFloat(-0.1f, 0.1f);

            child.VoicePitchModifier += fMutation;

            if (child.VoicePitchModifier < 0f)
            {
                fMutation = RandomUtil.GetFloat(0f, 0.2f);

                child.VoicePitchModifier = fMutation;
            }
            else if (child.VoicePitchModifier > 1f)
            {
                fMutation = RandomUtil.GetFloat(0f, 0.2f);

                child.VoicePitchModifier = 1f - fMutation;
            }
        }
Ejemplo n.º 2
0
 public void RequestSetVoiceVariation(VoiceVariationType voice)
 {
     mCASModel.RequestSetVoiceVariation(voice);
 }
Ejemplo n.º 3
0
        protected bool PrivatePerform(Common.IStatGenerator stats, SimDescription mom, SimDescription dad, bool forcePitch)
        {
            VoiceVariationType voice = VoiceVariationType.A;

            if (Sim.Child)
            {
                if (RandomUtil.CoinFlip())
                {
                    voice = VoiceVariationType.B;
                }

                stats.IncStat("Voice Child Random");
            }
            else if (Sim.TeenOrAbove)
            {
                if (RandomUtil.CoinFlip())
                {
                    if (dad != null)
                    {
                        voice = dad.VoiceVariation;

                        stats.IncStat("Voice From Dad");
                    }
                    else if (mom != null)
                    {
                        voice = mom.VoiceVariation;

                        stats.IncStat("Voice From Mom");
                    }
                    else
                    {
                        voice = unchecked ((VoiceVariationType)RandomUtil.GetInt(0, 2));

                        stats.IncStat("Voice Teen Random");
                    }
                }
                else
                {
                    if (mom != null)
                    {
                        voice = mom.VoiceVariation;

                        stats.IncStat("Voice From Mom");
                    }
                    else if (dad != null)
                    {
                        voice = dad.VoiceVariation;

                        stats.IncStat("Voice From Dad");
                    }
                    else
                    {
                        voice = unchecked ((VoiceVariationType)RandomUtil.GetInt(0, 2));

                        stats.IncStat("Voice Teen Random");
                    }
                }
            }

            Sim.VoiceVariation = voice;

            if ((forcePitch) || (Sim.Baby))
            {
                if (Sim.IsMale)
                {
                    if (dad != null)
                    {
                        Sim.VoicePitchModifier = dad.VoicePitchModifier;

                        stats.IncStat("Pitch From Dad");
                    }
                    else
                    {
                        Sim.VoicePitchModifier = RandomUtil.GetFloat(0f, 0.6f);

                        stats.IncStat("Pitch Random");
                    }
                }
                else
                {
                    if (mom != null)
                    {
                        Sim.VoicePitchModifier = mom.VoicePitchModifier;

                        stats.IncStat("Pitch From Mom");
                    }
                    else
                    {
                        Sim.VoicePitchModifier = RandomUtil.GetFloat(0.4f, 1f);

                        stats.IncStat("Pitch Random");
                    }
                }

                float fMutation = RandomUtil.GetFloat(-0.1f, 0.1f);

                Sim.VoicePitchModifier += fMutation;

                if (Sim.VoicePitchModifier < 0f)
                {
                    fMutation = RandomUtil.GetFloat(0f, 0.2f);

                    Sim.VoicePitchModifier = fMutation;
                }
                else if (Sim.VoicePitchModifier > 1f)
                {
                    fMutation = RandomUtil.GetFloat(0f, 0.2f);

                    Sim.VoicePitchModifier = 1f - fMutation;
                }

                stats.AddStat("Baby Pitch", Sim.VoicePitchModifier);
            }

            return(true);
        }