Пример #1
0
    internal static Result SearchInventory(IList <MechComponentRef> componentRefs)
    {
        var result = new Result();

        foreach (var componentRef in componentRefs)
        {
            var componentDef = componentRef.Def;

            if (componentDef.Is <EngineHeatSinkDef>())
            {
                result.HeatSinks.Add(componentRef);
            }

            if (componentDef.Is <CoolingDef>(out var coolingDef))
            {
                result.CoolingDef = coolingDef;
            }

            if (componentDef.Is <EngineCoreDef>(out var coreDef))
            {
                result.CoreDef = coreDef;
            }

            if (componentDef.Is <EngineHeatBlockDef>(out var blockDef))
            {
                result.HeatBlockDef = blockDef;
            }
        }

        result.WeightFactors = WeightsUtils.GetWeightFactorsFromInventory(componentRefs);

        return(result);
    }
Пример #2
0
    //Takes TONNAGE_PER_ARMOR_POINT and multiplies it by the ArmorFactor provided by equipped items.
    public static float TonPerPointWithFactor(MechDef mechDef)
    {
        var tonPerPoint         = UnityGameInstance.BattleTechGame.MechStatisticsConstants.TONNAGE_PER_ARMOR_POINT;
        var armorFactor         = WeightsUtils.CalculateArmorFactor(mechDef);
        var adjustedTonPerPoint = tonPerPoint * armorFactor;

        return(adjustedTonPerPoint);
    }
Пример #3
0
 internal Weights(MechDef mechDef)
 {
     StandardArmorWeight           = mechDef.StandardArmorTonnage();
     StandardStructureWeight       = mechDef.Chassis.Tonnage / 10f;
     StandardChassisWeightCapacity = mechDef.Chassis.Tonnage;
     Engine             = mechDef.GetEngine();
     Factors            = Engine?.WeightFactors ?? WeightsUtils.GetWeightFactorsFromInventory(mechDef.Inventory);
     ComponentSumWeight = mechDef.Inventory.Sum(mechComponentRef => mechComponentRef.Def.Tonnage) - (Engine?.CoreDef.Def.Tonnage ?? 0);
 }