Beyond_Beyaan.Equipment.GetSize C# (CSharp) Метод

GetSize() публичный Метод

public GetSize ( int>.Dictionary techLevels, int shipSize ) : float
techLevels int>.Dictionary
shipSize int
Результат float
        public float GetSize(Dictionary<TechField, int> techLevels, int shipSize)
        {
            float initialSize = 0;
            if (Technology.GenericSize == 0) //It uses the ship-specific size cost
            {
                switch (shipSize)
                {
                    case 0:
                        initialSize = UseSecondary ? Technology.SmallSecondarySize : Technology.SmallSize;
                        break;
                    case 1:
                        initialSize = UseSecondary ? Technology.MediumSecondarySize : Technology.MediumSize;
                        break;
                    case 2:
                        initialSize = UseSecondary ? Technology.LargeSecondarySize : Technology.LargeSize;
                        break;
                    case 3:
                        initialSize = UseSecondary ? Technology.HugeSecondarySize : Technology.HugeSize;
                        break;
                }
            }
            else
            {
                if (Technology.WeaponType == Technology.MISSILE_WEAPON)
                {
                    initialSize = UseSecondary ? Technology.GenericSize * 1.5f : Technology.GenericSize;
                }
                else
                {
                    initialSize = UseSecondary ? Technology.GenericSecondarySize : Technology.GenericSize;
                }
            }
            int levelDifference = techLevels[Technology.TechField] - Technology.TechLevel;
            if (levelDifference < 0)
            {
                levelDifference = 0;
            }
            else if (levelDifference > 50)
            {
                levelDifference = 50; //Cap the miniaturization at 50 levels
            }
            if (Technology.TechField == TechField.WEAPON) //Weapons enjoy 50% miniauratization rate
            {
                return (float)(initialSize * (Math.Pow(0.5, (levelDifference / 10.0))));
            }
            return (float)(initialSize * (Math.Pow(0.75, (levelDifference / 10.0))));
        }