Esempio n. 1
0
        public Disease(string id, byte strength, RangeInfo temperature_range, RangeInfo temperature_half_lives, RangeInfo pressure_range, RangeInfo pressure_half_lives)
            : base(id, null, null)
        {
            name    = new StringKey("STRINGS.DUPLICANTS.DISEASES." + id.ToUpper() + ".NAME");
            this.id = id;
            DiseaseVisualization.Info info = Assets.instance.DiseaseVisualization.GetInfo(id);
            overlayColour        = info.overlayColour;
            temperatureRange     = temperature_range;
            temperatureHalfLives = temperature_half_lives;
            pressureRange        = pressure_range;
            pressureHalfLives    = pressure_half_lives;
            PopulateElemGrowthInfo();
            ApplyRules();
            string str = Strings.Get("STRINGS.DUPLICANTS.DISEASES." + id.ToUpper() + ".LEGEND_HOVERTEXT").ToString();

            overlayLegendHovertext = str + DUPLICANTS.DISEASES.LEGEND_POSTAMBLE;
            Attribute attribute  = new Attribute(id + "Min", "Minimum" + id.ToString(), string.Empty, string.Empty, 0f, Attribute.Display.Normal, false, null, null);
            Attribute attribute2 = new Attribute(id + "Max", "Maximum" + id.ToString(), string.Empty, string.Empty, 1E+07f, Attribute.Display.Normal, false, null, null);

            amountDeltaAttribute = new Attribute(id + "Delta", id.ToString(), string.Empty, string.Empty, 0f, Attribute.Display.Normal, false, null, null);
            amount = new Amount(id, id + " " + DUPLICANTS.DISEASES.GERMS, id + " " + DUPLICANTS.DISEASES.GERMS, attribute, attribute2, amountDeltaAttribute, false, Units.Flat, 0.01f, true, null, null);
            Db.Get().Attributes.Add(attribute);
            Db.Get().Attributes.Add(attribute2);
            Db.Get().Attributes.Add(amountDeltaAttribute);
            cureSpeedBase           = new Attribute(id + "CureSpeed", false, Attribute.Display.Normal, false, 0f, null, null);
            cureSpeedBase.BaseValue = 1f;
            cureSpeedBase.SetFormatter(new ToPercentAttributeFormatter(1f, GameUtil.TimeSlice.None));
            Db.Get().Attributes.Add(cureSpeedBase);
        }
Esempio n. 2
0
    private void MapBuilding()
    {
        BuildingDef def = building.Def;

        if (def.CheckRequiresPowerInput())
        {
            ports |= Ports.PowerIn;
        }
        if (def.CheckRequiresPowerOutput())
        {
            ports |= Ports.PowerOut;
        }
        if (def.CheckRequiresGasInput())
        {
            ports |= Ports.GasIn;
        }
        if (def.CheckRequiresGasOutput())
        {
            ports |= Ports.GasOut;
        }
        if (def.CheckRequiresLiquidInput())
        {
            ports |= Ports.LiquidIn;
        }
        if (def.CheckRequiresLiquidOutput())
        {
            ports |= Ports.LiquidOut;
        }
        if (def.CheckRequiresSolidInput())
        {
            ports |= Ports.SolidIn;
        }
        if (def.CheckRequiresSolidOutput())
        {
            ports |= Ports.SolidOut;
        }
        DiseaseVisualization.Info info = Assets.instance.DiseaseVisualization.GetInfo(def.DiseaseCellVisName);
        if (info.name != null)
        {
            diseaseSourceSprite = Assets.instance.DiseaseVisualization.overlaySprite;
            diseaseSourceColour = info.overlayColour;
        }
        ISecondaryInput component = def.BuildingComplete.GetComponent <ISecondaryInput>();

        if (component != null)
        {
            switch (component.GetSecondaryConduitType())
            {
            case ConduitType.Gas:
                secondary_ports |= Ports.GasIn;
                break;

            case ConduitType.Liquid:
                secondary_ports |= Ports.LiquidIn;
                break;
            }
        }
        ISecondaryOutput component2 = def.BuildingComplete.GetComponent <ISecondaryOutput>();

        if (component2 != null)
        {
            switch (component2.GetSecondaryConduitType())
            {
            case ConduitType.Gas:
                secondary_ports |= Ports.GasOut;
                break;

            case ConduitType.Liquid:
                secondary_ports |= Ports.LiquidOut;
                break;
            }
        }
    }