Exemplo n.º 1
0
        private void SetTemperature()
        {
            this.lastTemperatureLow  = this.maxTemp;
            this.lastTemperatureHigh = this.minTemp;

            int cell = this.NaturalBuildingCell();

            ListPool <ScenePartitionerEntry, LogicMassSensor> .PooledList pooledList = ListPool <ScenePartitionerEntry, LogicMassSensor> .Allocate();

            GameScenePartitioner.Instance.GatherEntries(Grid.CellToXY(cell).x, Grid.CellToXY(cell).y, 1, 1, GameScenePartitioner.Instance.pickupablesLayer, pooledList);
            for (int i = 0; i < pooledList.Count; i++)
            {
                Pickupable pickupable = pooledList[i].obj as Pickupable;
                if (!(pickupable == null))
                {
                    if (!pickupable.wasAbsorbed)
                    {
                        float temperature = pickupable.PrimaryElement.Temperature;

                        if (temperature > this.lastTemperatureHigh)
                        {
                            this.lastTemperatureHigh = temperature;
                        }

                        if (temperature < this.lastTemperatureLow)
                        {
                            this.lastTemperatureLow = temperature;
                        }
                    }
                }
            }
            pooledList.Recycle();
            ReadPrivate.Set(typeof(LogicTemperatureSensor), this, "averageTemp", this.activateOnWarmerThan ? this.lastTemperatureLow : this.lastTemperatureHigh);
        }
Exemplo n.º 2
0
        protected override void OnSpawn()
        {
            base.OnToggle += new Action <bool>(this.OnSwitchToggled);

            // set private structureTemperature in LogicTemperatureSensor
            ReadPrivate.Set(typeof(LogicTemperatureSensor), this, "structureTemperature", GameComps.StructureTemperatures.GetHandle(base.gameObject));
        }
Exemplo n.º 3
0
        private void SetTemperature()
        {
            float      temperature = 0;
            GameObject go          = Grid.Objects[this.cell, (int)ObjectLayer.Building];

            if (go != null)
            {
                PrimaryElement element = go.GetComponent <PrimaryElement>();
                if (element != null)
                {
                    temperature = element.Temperature;
                }
            }
            ReadPrivate.Set(typeof(LogicTemperatureSensor), this, "averageTemp", temperature);
        }
 public static bool Prefix(Switch __instance)
 {
     ReadPrivate.Call(__instance, "Toggle");
     return(false);
 }