当前位置: 首页>>代码示例>>C#>>正文


C# Equipment.GetSize方法代码示例

本文整理汇总了C#中Equipment.GetSize方法的典型用法代码示例。如果您正苦于以下问题:C# Equipment.GetSize方法的具体用法?C# Equipment.GetSize怎么用?C# Equipment.GetSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Equipment的用法示例。


在下文中一共展示了Equipment.GetSize方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetSpaceUsed

 private float GetSpaceUsed(Technology whichTech, bool useSecondary)
 {
     Equipment equipment = new Equipment(whichTech, useSecondary);
     return equipment.GetSize(_techLevels, _shipDesign.Size) + equipment.GetPower(_shipDesign.Size) * _spacePerPower;
 }
开发者ID:Beyonders,项目名称:Beyond-Beyaan,代码行数:5,代码来源:ShipDesignScreen.cs

示例2: AtLeastOneHigherLevelSpecial

        private bool AtLeastOneHigherLevelSpecial(Equipment special, float remainingSpace)
        {
            float currentSpecialSpaceUsage = 0;
            int index = -1;
            if (special != null)
            {
                currentSpecialSpaceUsage = special.GetSize(_techLevels, _shipDesign.Size);
                index = _availableSpecialTechs.IndexOf(special.Technology);
            }
            float totalAvailableSpace = currentSpecialSpaceUsage + remainingSpace;

            for (int i = index + 1; i < _availableSpecialTechs.Count; i++)
            {
                if (GetSpaceUsed(_availableSpecialTechs[i], false) <= totalAvailableSpace)
                {
                    return true;
                }
            }
            return false;
        }
开发者ID:Beyonders,项目名称:Beyond-Beyaan,代码行数:20,代码来源:ShipDesignScreen.cs

示例3: AtLeastOneBetterEngine

 private bool AtLeastOneBetterEngine(float remainingSpace)
 {
     if (_shipDesign.Engine.Key.Technology == _availableEngineTechs[_availableEngineTechs.Count - 1])
     {
         //Already the best engine
         return false;
     }
     int index = _availableEngineTechs.IndexOf(_shipDesign.Engine.Key.Technology) + 1; //Just one level higher will suffice
     Equipment engine = new Equipment(_availableEngineTechs[index], false);
     float totalSpace = (engine.GetSize(_techLevels, _shipDesign.Size) / (engine.Technology.Speed * 10)) * _shipDesign.PowerUsed;
     return totalSpace <= remainingSpace;
 }
开发者ID:Beyonders,项目名称:Beyond-Beyaan,代码行数:12,代码来源:ShipDesignScreen.cs

示例4: AtLeastOneBetterWeapon

        private bool AtLeastOneBetterWeapon(KeyValuePair<Equipment, int> weapon, float remainingSpace)
        {
            float currentWeaponSpaceUsage = 0;
            int index = -1;
            if (weapon.Key != null)
            {
                currentWeaponSpaceUsage = weapon.Key.GetSize(_techLevels, _shipDesign.Size) * weapon.Value;
                index = _availableWeaponTechs.IndexOf(weapon.Key.Technology);
            }
            float totalAvailableSpace = remainingSpace + currentWeaponSpaceUsage;

            if (weapon.Key != null && !weapon.Key.UseSecondary && weapon.Key.Technology.MaximumSecondaryWeaponDamage > 0)
            {
                //There is a bigger version of the weapon, see if there's room for it
                Equipment bigWeapon = new Equipment(weapon.Key.Technology, true);
                if (bigWeapon.GetSize(_techLevels, _shipDesign.Size) <= totalAvailableSpace)
                {
                    return true;
                }
            }
            for (int i = index + 1; i < _availableWeaponTechs.Count; i++)
            {
                if (GetSpaceUsed(_availableWeaponTechs[i], false) <= totalAvailableSpace)
                {
                    return true;
                }
            }
            return false;
        }
开发者ID:Beyonders,项目名称:Beyond-Beyaan,代码行数:29,代码来源:ShipDesignScreen.cs

示例5: AtLeastOneBetterArmor

 private bool AtLeastOneBetterArmor(float remainingSpace)
 {
     if (_shipDesign.Armor.Technology == _availableArmorTechs[_availableArmorTechs.Count - 1])
     {
         if (_shipDesign.Armor.UseSecondary)
         {
             //Already the best armor with double hull
             return false;
         }
         Equipment armor = new Equipment(_shipDesign.Armor.Technology, true);
         return armor.GetSize(_techLevels, _shipDesign.Size) <= remainingSpace;
     }
     int index = _availableArmorTechs.IndexOf(_shipDesign.Armor.Technology) + 1; //Just one level higher will suffice
     return GetSpaceUsed(_availableArmorTechs[index], false) <= remainingSpace;
 }
开发者ID:Beyonders,项目名称:Beyond-Beyaan,代码行数:15,代码来源:ShipDesignScreen.cs


注:本文中的Equipment.GetSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。