Category5.Tornado.CalculateCategory C# (CSharp) Method

CalculateCategory() private method

private CalculateCategory ( float elapsedMilliseconds ) : void
elapsedMilliseconds float
return void
        private void CalculateCategory(float elapsedMilliseconds)
        {
            List<float> categoryValues = new List<float>();
            categoryValues.Add(GaleValue);
            categoryValues.Add(Category1Value);
            categoryValues.Add(Category2Value);
            categoryValues.Add(Category3Value);
            categoryValues.Add(Category4Value);
            categoryValues.Add(Category5Value);

            CategoryValue = TotalMass;

            // check if needs to go up to next category
            for (int i=1; i <= (int)TornadoCategory.Category5; i++)
            {
                float iCatValue = categoryValues[i];
                if (CategoryValue >= iCatValue && i > (int)Category)
                {
                    Category = (TornadoCategory)i;

                    ParentLevel.Music.Play((int)Category, true);
                }
            }

            // check if needs to go down to previous category
            for (int i=1; i <= (int)TornadoCategory.Category5; i++)
            {
                float iCatValue = categoryValues[i];
                if (CategoryValue < iCatValue * 0.9f && (i - 1) < (int)Category)
                {
                    Category = (TornadoCategory)(i-1);

                    ParentLevel.Music.Play((int)Category, true);
                }
            }
        }