コード例 #1
0
 public void ComputePersonality(int ind, float mean, float std)
 {
     personality[ind] = MathDefs.GaussianDist(mean, std);
     if (personality[ind] < -1f)
     {
         personality[ind] = -1f;
     }
     else if (personality[ind] > 1f)
     {
         personality[ind] = 1f;
     }
 }
コード例 #2
0
ファイル: Contagion.cs プロジェクト: BibleUs/Personality
    public void AddDose(float sus)
    {
        if (Status == StatusType.Susceptible || Status == StatusType.Wounded)
        {
            float d;

            d = MathDefs.GaussianDist(DoseMean, DoseVariance);

            dose += d * sus * Time.deltaTime;

            UpdateStatus();
        }
    }
コード例 #3
0
ファイル: Contagion.cs プロジェクト: BibleUs/Personality
    public void DecayDose()
    {
        float d;
        float decayCoef = 2f;         //decays in twice the time as it increases

        d = MathDefs.GaussianDist(DoseMean / decayCoef, DoseVariance / decayCoef);

        //take some percentage of the normal dose depending on susceptibility
        dose -= d * susceptibility * Time.deltaTime;

        if (dose < 0f)
        {
            dose = 0f;
        }

        UpdateStatus();
    }