MPlayer.HandleStatChange C# (CSharp) Method

HandleStatChange() private method

private HandleStatChange ( MPlayerStat, stat ) : void
stat MPlayerStat,
return void
    private void HandleStatChange(MPlayerStat stat)
    {
        currentStatTotal = 0;
        foreach(MPlayerStat eachStat in stats)
        {
            currentStatTotal += eachStat.amount;
        }

        if(currentStatTotal % leapThreshold == 0 && statTotal != 0)
        {
            int newLeapLevel = (int) Mathf.Floor ((float)currentStatTotal/(float)leapThreshold);

            if(leapLevel != newLeapLevel)
            {
                leapLevel = newLeapLevel;

                FSoundManager.PlaySound("EvolutionaryLeap",1.0f);

                if(currentStatTotal == statTotal)
                {
                    if(isHuman) MGame.instance.ShowNote("MAX EVOLVED!", 3.0f);
                }
                else
                {
                    if(isHuman) MGame.instance.ShowNote("EVOLUTIONARY LEAP!\n +25% TO ALL MUTATIONS", 5.0f);

                    foreach(MPlayerStat eachStat in stats)
                    {
                        eachStat.Leap();
                    }
                }
            }
        }

        isDirty = true;
        areStatsDirty = true;
    }