Ejemplo n.º 1
0
        private static void ApplyColorToBuilding(BuildingComplete building, Color color)
        {
            TreeFilterable      treeFilterable;
            Ownable             ownable;
            KAnimControllerBase kAnimBase;

            if ((ownable = building.GetComponent <Ownable>()) != null)
            {
                Traverse.Create(ownable).Field("ownedTint").SetValue(color);
                Traverse.Create(ownable).Method("UpdateTint").GetValue();
            }
            else if ((treeFilterable = building.GetComponent <TreeFilterable>()) != null)
            {
                FilteredStorage filteredStorage = ExtractFilteredStorage(treeFilterable);

                if (filteredStorage != null)
                {
                    filteredStorage.filterTint = color;
                    filteredStorage.FilterChanged();
                }
            }
            else if ((kAnimBase = building.GetComponent <KAnimControllerBase>()) != null)
            {
                kAnimBase.TintColour = color;
            }
            else
            {
                State.Common.Logger.LogOnce("Invalid building <{building}> and its not a registered tile.");
            }
        }
    protected override void OnSpawn()
    {
        Operational component = GetComponent <Operational>();

        component.SetActive(component.IsOperational, false);
        filteredStorage.FilterChanged();
    }
Ejemplo n.º 3
0
 protected override void OnSpawn()
 {
     filteredStorage.FilterChanged();
     if (!LockerName.IsNullOrWhiteSpace())
     {
         SetName(LockerName);
     }
 }
Ejemplo n.º 4
0
 private static void SetFilteredStorageColors(
     [NotNull] FilteredStorage storage,
     Color32 color,
     Color32 dimmedColor)
 {
     storage.filterTint   = color;
     storage.noFilterTint = dimmedColor;
     storage.FilterChanged();
 }
Ejemplo n.º 5
0
 protected override void OnSpawn()
 {
     operational.SetActive(operational.IsOperational, false);
     GetComponent <KAnimControllerBase>().Play("off", KAnim.PlayMode.Once, 1f, 0f);
     filteredStorage.FilterChanged();
     temperatureAdjuster = new SimulatedTemperatureAdjuster(simulatedInternalTemperature, simulatedInternalHeatCapacity, simulatedThermalConductivity, base.GetComponent <Storage>());
     UpdateLogicCircuit();
     Subscribe((int)GameHashes.OperationalChanged, new Action <object>(OnOperationalChanged));
     Subscribe((int)GameHashes.CopySettings, new Action <object>(OnCopySettings));
     Subscribe(-1697596308, new Action <object>(UpdateLogicCircuitCB));
     Subscribe(-592767678, new Action <object>(UpdateLogicCircuitCB));
 }
Ejemplo n.º 6
0
 protected override void OnSpawn()
 {
     operational.SetActive(operational.IsOperational, false);
     GetComponent <KAnimControllerBase>().Play("off", KAnim.PlayMode.Once, 1f, 0f);
     filteredStorage.FilterChanged();
     temperatureAdjuster = new SimulatedTemperatureAdjuster(simulatedInternalTemperature, simulatedInternalHeatCapacity, simulatedThermalConductivity, GetComponent <Storage>());
     UpdateLogicCircuit();
     Subscribe(-592767678, OnOperationalChangedDelegate);
     Subscribe(-905833192, OnCopySettingsDelegate);
     Subscribe(-1697596308, UpdateLogicCircuitCBDelegate);
     Subscribe(-592767678, UpdateLogicCircuitCBDelegate);
 }
Ejemplo n.º 7
0
        private static void SetFilteredStorageColors(
            [NotNull] object _storage,
            Color32 color,
            Color32 dimmedColor)
        {
            FilteredStorage storage = (FilteredStorage)GetField(_storage, "filteredStorage");

            //storage.filterTint   = color;
            SetField(storage, "filterTint", color);
            //storage.noFilterTint = dimmedColor;
            SetField(storage, "noFilterTint", dimmedColor);
            storage.FilterChanged();
        }
 protected override void OnSpawn()
 {
     base.OnSpawn();
     smi = new Instance(this, base.IsSwitchedOn);
     smi.StartSM();
     if (infoStatusItem == null)
     {
         infoStatusItem = new StatusItem("ObjectDispenserAutomationInfo", "BUILDING", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 129022);
         infoStatusItem.resolveStringCallback = ResolveInfoStatusItemString;
     }
     filteredStorage.FilterChanged();
     GetComponent <KSelectable>().ToggleStatusItem(infoStatusItem, true, smi);
 }
        protected override void OnSpawn()
        {
            List <GameObject> myObjects = new List <GameObject>();

            foreach (Tag myTagCat in GameTags.UnitCategories)
            {
                myObjects = (Assets.GetPrefabsWithTag(myTagCat));
                foreach (GameObject myObject in myObjects)
                {
                    Tag myTag;
                    if (myTagCat == GameTags.Compostable || myTagCat == GameTags.HighEnergyParticle)
                    {
                        myTag = myObject.tag;
                    }
                    else
                    {
                        myTag = myObject.name.ToString();
                        if (myTagCat == GameTags.Compostable)
                        {
                            if (myTag.ToString() != "Untagged")
                            {
                                DiscoveredResources.Instance.Discover(myTag, GameTags.Seed);
                            }
                        }
                        else
                        {
                            DiscoveredResources.Instance.Discover(myTag, myTagCat);
                        }
                    }
                }
            }
            filteredStorage.FilterChanged();
            if (!this.lockerName.IsNullOrWhiteSpace())
            {
                SetName(lockerName);
            }
        }
Ejemplo n.º 10
0
        protected override void OnSpawn()
        {
            Tag myTag;

            foreach (EdiblesManager.FoodInfo foodTypes in EdiblesManager.GetAllFoodTypes())
            {
                Tag tag = foodTypes.Id.ToTag();
                if (foodTypes.CaloriesPerUnit > 0.0)
                {
                    DiscoveredResources.Instance.Discover(tag, GameTags.Edible);
                }
                if (foodTypes.CaloriesPerUnit == 0.0)
                {
                    DiscoveredResources.Instance.Discover(tag, GameTags.CookingIngredient);
                }
            }

            List <GameObject> myObjects = (Assets.GetPrefabsWithTag(GameTags.Medicine));

            foreach (GameObject myObject in myObjects)
            {
                myTag = myObject.PrefabID();
                if (myTag != "Untagged")
                {
                    DiscoveredResources.Instance.Discover(myTag, GameTags.Medicine);
                }
                ;
            }

            operational.SetActive(operational.IsOperational, false);
            GetComponent <KAnimControllerBase>().Play("off", KAnim.PlayMode.Once, 1f, 0.0f);
            filteredStorage.FilterChanged();
            temperatureAdjuster = new SimulatedTemperatureAdjuster(simulatedInternalTemperature, simulatedInternalHeatCapacity, simulatedThermalConductivity, base.GetComponent <Storage>());

            this.UpdateLogicCircuit();
        }
Ejemplo n.º 11
0
 protected override void OnSpawn()
 {
     filteredStorage.FilterChanged();
 }