コード例 #1
0
 public BaseModuleType(Texture2D icon, GameObject[] moduleObjects)
 {
     //These settings are designed to keep the game from crashing, not to provide any functionality.
     ModuleObjects = moduleObjects;
     mIcon         = icon;
     mMinSize      = 0;
     mMaxSize      = 0;
     mDefaultSize  = 0;
     initStrings();
     mCost = new ResourceAmounts();
 }
コード例 #2
0
        public override ResourceAmounts calculateCost(int sizeIndex)
        {
            if (ResourceCosts.Count - 1 < sizeIndex)
            {
                ResourceCosts.AddRange(new ResourceAmounts[sizeIndex - (ResourceCosts.Count - 1)]);
            }

            if (ResourceCosts[sizeIndex] == null)
            {
                ResourceCosts[sizeIndex] = new ResourceAmounts();

                foreach (ResourceAmount baseResource in BaseResourceCosts)
                {
                    ResourceCosts[sizeIndex].add(baseResource.mResourceType, baseResource.mAmount + sizeIndex);
                }
            }

            return(ResourceCosts[sizeIndex]);
        }
コード例 #3
0
        public VegetableConverter()
        {
            //The cost to build the component
            mConstructionCosts = new ResourceAmounts();
            mConstructionCosts.add(TypeList <ResourceType, ResourceTypeList> .find <Metal>(), 1);

            //The icon to display when selecting the component on the module's component build menu.
            //This can also be loaded from the assets folder via mod.ModTextures.FindTextureWithName("icon.png");
            mIcon = ComponentInstance.getIcon();

            //The resources the component uses for each item it produces
            mResourceConsumption = new List <ResourceType> {
                TypeList <ResourceType, ResourceTypeList> .find <Vegetables>()
            };

            //The resource to produce
            addResourceProduction <Starch>();

            //The amount of the raw resources the component can hold at a time
            mEmbeddedResourceCount = 3;

            //How long (in seconds I think) it takes to produce one item
            mResourceProductionPeriod = 100f;

            //How much power the machine continuously uses (or produces)
            mPowerGeneration = -1000;

            //Various settings are configured by adding or bitwise-or flag constants together
            mFlags = FlagRequiresOperator + FlagCanBeDisabled + FlagStoreProduction;

            //Set who can use the component
            mOperatorSpecialization = TypeList <Specialization, SpecializationList> .find <Worker>();

            //Set the animation for working on the component
            addUsageAnimation(CharacterAnimationType.WorkStanding);

            mName    = "Vegetable Converter";
            mTooltip = "Turns vegetables into starch.";
        }