public float GetAverageOxidizerEfficiency()
    {
        Dictionary <Tag, float> dictionary = new Dictionary <Tag, float>();

        dictionary[SimHashes.LiquidOxygen.CreateTag()] = 0f;
        dictionary[SimHashes.OxyRock.CreateTag()]      = 0f;
        foreach (GameObject item in AttachableBuilding.GetAttachedNetwork(commandModule.GetComponent <AttachableBuilding>()))
        {
            OxidizerTank component = item.GetComponent <OxidizerTank>();
            if ((Object)component != (Object)null)
            {
                Dictionary <Tag, float> oxidizersAvailable = component.GetOxidizersAvailable();
                foreach (KeyValuePair <Tag, float> item2 in oxidizersAvailable)
                {
                    if (dictionary.ContainsKey(item2.Key))
                    {
                        Dictionary <Tag, float> dictionary2;
                        Tag key;
                        (dictionary2 = dictionary)[key = item2.Key] = dictionary2[key] + item2.Value;
                    }
                }
            }
        }
        float num  = 0f;
        float num2 = 0f;

        foreach (KeyValuePair <Tag, float> item3 in dictionary)
        {
            num  += item3.Value * oxidizerEfficiencies[item3.Key];
            num2 += item3.Value;
        }
        if (num2 == 0f)
        {
            return(0f);
        }
        float num3 = num / num2;

        return(num3 * 100f);
    }
Ejemplo n.º 2
0
        public void GetOxidizerAmounts(out float oxyrock, out float lox)
        {
            oxyrock = 0;
            lox     = 0;

            foreach (GameObject gameObject in BuildingNetworkEnumerable())
            {
                OxidizerTank component = gameObject.GetComponent <OxidizerTank>();
                if (component != null)
                {
                    foreach (KeyValuePair <Tag, float> oxidizer in component.GetOxidizersAvailable())
                    {
                        if (oxidizer.Key == SimHashes.LiquidOxygen.CreateTag())
                        {
                            lox += oxidizer.Value;
                        }
                        else if (oxidizer.Key == SimHashes.OxyRock.CreateTag())
                        {
                            oxyrock += oxidizer.Value;
                        }
                    }
                }
            }
        }