Пример #1
0
 public void AddDisease(byte disease_idx, int delta, string reason)
 {
     if (delta != 0)
     {
         if ((bool)diseaseRedirectTarget)
         {
             diseaseRedirectTarget.AddDisease(disease_idx, delta, reason);
         }
         else if (useSimDiseaseInfo)
         {
             int gameCell = Grid.PosToCell(this);
             SimMessages.ModifyDiseaseOnCell(gameCell, disease_idx, delta);
         }
         else if (diseaseHandle.IsValid())
         {
             int num = GameComps.DiseaseContainers.AddDisease(diseaseHandle, disease_idx, delta);
             if (num <= 0)
             {
                 GameComps.DiseaseContainers.Remove(base.gameObject);
                 diseaseHandle.Clear();
             }
         }
         else if (delta > 0)
         {
             diseaseHandle = GameComps.DiseaseContainers.Add(base.gameObject, disease_idx, delta);
             Trigger(-1689370368, true);
             Trigger(-283306403, null);
         }
     }
 }
Пример #2
0
        protected override void OnSpawn()
        {
            CheckRequirements(forceEvent: true);

            partitionerEntry = GameScenePartitioner.Instance.Add("RequireConduitOutput.OnSpawn", base.gameObject, conduitInput.GetUtilityCell(), conduitInput.ScenePartitionerLayer, OnConduitConnectionChanged);
            conduitInput.ConduitManager.AddConduitUpdater(OnConduitUpdate, ConduitFlowPriority.First);
        }
 public override void OnPlay(AnimEventManager.EventPlayerData behaviour)
 {
     if (!string.IsNullOrEmpty(base.sound) && SoundEvent.ShouldPlaySound(behaviour.controller, base.sound, base.looping, isDynamic))
     {
         int        num        = -1;
         GameObject gameObject = behaviour.controller.gameObject;
         if (counterModulus >= -1)
         {
             HandleVector <int> .Handle h = GameComps.WhiteBoards.GetHandle(gameObject);
             if (!h.IsValid())
             {
                 h = GameComps.WhiteBoards.Add(gameObject);
             }
             num = (GameComps.WhiteBoards.HasValue(h, base.soundHash) ? ((int)GameComps.WhiteBoards.GetValue(h, base.soundHash)) : 0);
             int num2 = (counterModulus != -1) ? ((num + 1) % counterModulus) : 0;
             GameComps.WhiteBoards.SetValue(h, base.soundHash, num2);
         }
         Vector3       position = behaviour.GetComponent <Transform>().GetPosition();
         EventInstance instance = SoundEvent.BeginOneShot(base.sound, position);
         if (instance.isValid())
         {
             if (num >= 0)
             {
                 instance.setParameterValue("eventCount", (float)num);
             }
             SoundEvent.EndOneShot(instance);
         }
     }
 }
Пример #4
0
        protected override void OnSpawn()
        {
            base.OnSpawn();

            // Create efficiency meter
            meter = new MeterController(GetComponent <KBatchedAnimController>(), "meter_target", "meter", Meter.Offset.Infront, Grid.SceneLayer.NoLayer, "meter_target", "meter_fill", "meter_frame", "meter_OL");

            // Determine heat source cell
            int x, y;

            Grid.CellToXY(Grid.PosToCell(this), out x, out y);
            heatSourceCell = Grid.XYToCell(x, y - 2);

            // Get structure temperature handle
            structureTemperature = GameComps.StructureTemperatures.GetHandle(base.gameObject);

            // Get configurable attributes
            minTemperatureDifferenceK = ModSettings.Instance.MinimumTemperatureDifference;
            maxHeatToPumpDTU          = WattsToHeat(ModSettings.Instance.MaxWattOutput);
            wasteHeatRatio            = ModSettings.Instance.WasteHeatRatio;

            // Set up state machine
            smi = new Instance(this);
            smi.StartSM();
        }
Пример #5
0
    public HandleVector <int> .Handle Allocate(ConduitType conduit_type, int conduit_idx, HandleVector <int> .Handle conduit_structure_temperature_handle, ref ConduitFlow.ConduitContents contents)
    {
        StructureTemperaturePayload payload = GameComps.StructureTemperatures.GetPayload(conduit_structure_temperature_handle);
        Element     element = payload.primaryElement.Element;
        BuildingDef def     = payload.building.Def;
        float       conduit_heat_capacity        = def.MassForTemperatureModification * element.specificHeatCapacity;
        float       conduit_thermal_conductivity = element.thermalConductivity * def.ThermalConductivity;
        int         num = ConduitTemperatureManager_Add(contents.temperature, contents.mass, (int)contents.element, payload.simHandleCopy, conduit_heat_capacity, conduit_thermal_conductivity, def.ThermalConductivity < 1f);

        HandleVector <int> .Handle result = default(HandleVector <int> .Handle);
        result.index = num;
        int handleIndex = Sim.GetHandleIndex(num);

        if (handleIndex + 1 > temperatures.Length)
        {
            Array.Resize(ref temperatures, (handleIndex + 1) * 2);
            Array.Resize(ref conduitInfo, (handleIndex + 1) * 2);
        }
        temperatures[handleIndex] = contents.temperature;
        conduitInfo[handleIndex]  = new ConduitInfo
        {
            type = conduit_type,
            idx  = conduit_idx
        };
        return(result);
    }
Пример #6
0
    public void UpdateVelocity(HandleVector <int> .Handle handle, Vector2 velocity)
    {
        Sound data = sounds.GetData(handle);

        data.velocity = velocity;
        sounds.SetData(handle, data);
    }
Пример #7
0
    public void GetData(HandleVector <int> .Handle handle, out Header header, out Payload payload)
    {
        int index = ComputeIndex(handle);

        header  = headers[index];
        payload = payloads[index];
    }
Пример #8
0
 /// <summary>
 /// Applied before Add runs.
 /// </summary>
 internal static bool Prefix(Accumulators __instance, ref HandleVector <int> .
                             Handle __result)
 {
     __result = __instance.accumulated.Allocate(0f);
     __instance.average.Allocate(float.NaN);
     return(false);
 }
    private void RefreshVisualCells()
    {
        this.choreRangeVisualizer.x      = -this.pickupRange / 2;
        this.choreRangeVisualizer.y      = 0;
        this.choreRangeVisualizer.width  = this.pickupRange;
        this.choreRangeVisualizer.height = this.pickupRange;
        if (selectable.IsSelected)
        {
            Traverse.Create(choreRangeVisualizer).Method("UpdateVisualizers").GetValue();
        }
        Vector2I   xy     = Grid.CellToXY(this.NaturalBuildingCell());
        int        cell   = Grid.XYToCell(xy.x, xy.y + this.pickupRange / 2);
        CellOffset offset = new CellOffset(0, this.pickupRange / 2);

        if ((bool)(UnityEngine.Object) this.rotatable)
        {
            CellOffset rotatedCellOffset = this.rotatable.GetRotatedCellOffset(offset);
            if (Grid.IsCellOffsetValid(this.NaturalBuildingCell(), rotatedCellOffset))
            {
                cell = Grid.OffsetCell(this.NaturalBuildingCell(), rotatedCellOffset);
            }
        }
        this.pickupableExtents = new Extents(cell, this.pickupRange / 2);
        GameScenePartitioner.Instance.Free(ref this.pickupablesChangedEntry);
        this.pickupablesChangedEntry = GameScenePartitioner.Instance.Add("CreatureSensor.PickupablesChanged", (object)this.gameObject, this.pickupableExtents, GameScenePartitioner.Instance.pickupablesChangedLayer, new System.Action <object>(this.OnPickupablesChanged));
        this.pickupablesDirty        = true;
    }
    private static void OnSolidChanged(HandleVector <int> .Handle handle)
    {
        FallerComponent data = GameComps.Fallers.GetData(handle);

        if (!((Object)data.transform == (Object)null))
        {
            Vector3 position = data.transform.GetPosition();
            position.y = position.y - data.offset - 0.1f;
            int num = Grid.PosToCell(position);
            if (Grid.IsValidCell(num))
            {
                bool flag = !Grid.Solid[num];
                if (flag != data.isFalling)
                {
                    data.isFalling = flag;
                    if (flag)
                    {
                        AddGravity(data.transform, Vector2.zero);
                    }
                    else
                    {
                        RemoveGravity(data.transform);
                    }
                }
            }
        }
    }
    protected override void OnSpawn(HandleVector <int> .Handle h)
    {
        base.OnSpawn(h);
        FallerComponent data = GetData(h);

        Singleton <CellChangeMonitor> .Instance.RegisterCellChangedHandler(data.transform, data.cellChangedCB, "FallerComponent.OnSpawn");
    }
 protected void StartAnimEventSequence()
 {
     if (!layering.GetIsForeground() && aem != null)
     {
         eventManagerHandle = aem.PlayAnim(this, curAnim, mode, elapsedTime, visibilityType == VisibilityType.Always);
     }
 }
 protected KAnimControllerBase()
 {
     KAnim.Anim.Frame invalidFrame = KAnim.Anim.Frame.InvalidFrame;
     curAnimFrameIdx = invalidFrame.idx;
     KAnim.Anim.Frame invalidFrame2 = KAnim.Anim.Frame.InvalidFrame;
     prevAnimFrame      = invalidFrame2.idx;
     eventManagerHandle = HandleVector <int> .InvalidHandle;
     overrideAnimFiles  = new List <OverrideAnimFileData>();
     DeepProfiler       = new DeepProfiler(false);
     playSpeed          = 1f;
     mode          = KAnim.PlayMode.Once;
     stopped       = true;
     animHeight    = 1f;
     animWidth     = 1f;
     _enabled      = true;
     hiddenSymbols = new List <KAnimHashedString>();
     anims         = new Dictionary <HashedString, AnimLookupData>();
     overrideAnims = new Dictionary <HashedString, AnimLookupData>();
     animQueue     = new Queue <AnimData>();
     fgLayer       = Grid.SceneLayer.NoLayer;
     base._002Ector();
     previousFrame       = -1;
     currentFrame        = -1;
     PlaySpeedMultiplier = 1f;
     synchronizer        = new KAnimSynchronizer(this);
     layering            = new KAnimLayering(this, fgLayer);
     isVisible           = true;
 }
    public HandleVector <int> .Handle Allocate(HandleVector <int> .Handle temperature_handle, ref ConduitFlow.ConduitContents contents)
    {
        byte elem_idx     = (byte)ElementLoader.GetElementIndex(contents.element);
        Data initial_data = new Data(temperature_handle, elem_idx, contents.mass, contents.diseaseIdx, contents.diseaseCount);

        return(Allocate(initial_data));
    }
 protected override void OnSpawn()
 {
     base.OnSpawn();
     if (!IsThereLiquid())
     {
         base.gameObject.DeleteObject();
     }
     else
     {
         Grid.Objects[Grid.PosToCell(base.gameObject), 8] = base.gameObject;
         new WorkChore <Moppable>(Db.Get().ChoreTypes.Mop, this, null, true, null, null, null, true, null, false, true, null, false, true, true, PriorityScreen.PriorityClass.basic, 5, false, true);
         SetWorkTime(float.PositiveInfinity);
         KSelectable component = GetComponent <KSelectable>();
         component.SetStatusItem(Db.Get().StatusItemCategories.Main, Db.Get().MiscStatusItems.WaitingForMop, null);
         Subscribe(493375141, OnRefreshUserMenuDelegate);
         overrideAnims = new KAnimFile[1]
         {
             Assets.GetAnim("anim_mop_dirtywater_kanim")
         };
         partitionerEntry = GameScenePartitioner.Instance.Add("Moppable.OnSpawn", base.gameObject, new Extents(Grid.PosToCell(this), new CellOffset[1]
         {
             new CellOffset(0, 0)
         }), GameScenePartitioner.Instance.liquidChangedLayer, OnLiquidChanged);
         Refresh();
         Subscribe(-1432940121, OnReachableChangedDelegate);
         ReachabilityMonitor.Instance instance = new ReachabilityMonitor.Instance(this);
         instance.StartSM();
         SimAndRenderScheduler.instance.Remove(this);
     }
 }
        protected override void OnSpawn()
        {
            base.OnSpawn();
            this.animController = base.GetComponent <KBatchedAnimController>();
            base.OnToggle      += new Action <bool>(this.OnSwitchToggled);
            this.UpdateVisualState(true);
            this.wasOn = this.switchedOn;

            // subscribe to add/remove pickupables on the cell in question
            int cell = this.NaturalBuildingCell();

            this.pickupablesChangedEntry = GameScenePartitioner.Instance.Add("ItemTemperatureSensor.PickupablesChanged", base.gameObject, cell, GameScenePartitioner.Instance.pickupablesChangedLayer, new Action <object>(this.OnPickupablesChanged));

            this.Update();

            // load refresh interval from config file
            this.refreshInterval = MoreTemperatureSensorsConfig.Config.GetItemInterval;

            this.itemCountThreshold = MoreTemperatureSensorsConfig.Config.ItemSensorItemCountFastThreshold;
            if (this.itemCountThreshold < 0)
            {
                this.itemCountThreshold = 0;
            }

            // Apply color
            this.OnOverlayChange("");
            OverlayChangeController.Add(this);
        }
Пример #17
0
        protected override void OnSpawn()
        {
            base.OnSpawn();
            _spawned = true;
            Debug.Log($"[MultiIO] ConduitIO.OnSpawn() -> ConduitType: {ConduitType.ToString()}  CellOffset: {CellOffset.x + "," + CellOffset.y}");
            portCell = GetPortCell();
            MultiIOExtensions.RegisterPort(portCell, this);
            //Register an event listener for any changes to the grid at the location of this port.
            ScenePartitionerLayer layer = GameScenePartitioner.Instance.objectLayers[(int)GetConduitObjectLayer()];

            partitionerEntry = GameScenePartitioner.Instance.Add("ConduitIO.OnSpawn", _parent, portCell, layer, delegate
            {
                UpdateConduitExistsStatus();
            });
            //Register this conduit to the relevant network. Allows the network to determine flow direction.
            IUtilityNetworkMgr networkManager = GetNetworkManager();

            _networkItem = new FlowUtilityNetwork.NetworkItem(ConduitType, EndpointType, portCell, _parent);
            networkManager.AddToNetworks(portCell, _networkItem, EndpointType != Endpoint.Conduit);

            if (UseConduitUpdater)
            {
                GetConduitManager().AddConduitUpdater(ConduitTick, FlowPriority);
            }

            UpdateConduitExistsStatus(true);
        }
    public FallerComponent(Transform transform, Vector2 initial_velocity)
    {
        this.transform      = transform;
        transformInstanceId = transform.GetInstanceID();
        isFalling           = false;
        initialVelocity     = initial_velocity;
        partitionerEntry    = default(HandleVector <int> .Handle);
        solidChangedCB      = null;
        cellChangedCB       = null;
        KCircleCollider2D component = transform.GetComponent <KCircleCollider2D>();

        if ((UnityEngine.Object)component != (UnityEngine.Object)null)
        {
            offset = component.radius;
        }
        else
        {
            KCollider2D component2 = transform.GetComponent <KCollider2D>();
            if ((UnityEngine.Object)component2 != (UnityEngine.Object)null)
            {
                Vector3 position = transform.GetPosition();
                float   y        = position.y;
                Vector3 min      = component2.bounds.min;
                offset = y - min.y;
            }
            else
            {
                offset = 0f;
            }
        }
    }
Пример #19
0
 public static void StopSound(HandleVector <int> .Handle handle)
 {
     if (!((UnityEngine.Object)Get() == (UnityEngine.Object)null))
     {
         Sound data = Get().sounds.GetData(handle);
         if (data.IsPlaying)
         {
             data.ev.stop(STOP_MODE.ALLOWFADEOUT);
             data.ev.release();
             SoundDescription             soundEventDescription = KFMOD.GetSoundEventDescription(data.path);
             SoundDescription.Parameter[] parameters            = soundEventDescription.parameters;
             for (int i = 0; i < parameters.Length; i++)
             {
                 SoundDescription.Parameter   parameter = parameters[i];
                 LoopingSoundParameterUpdater value     = null;
                 if (Get().parameterUpdaters.TryGetValue(parameter.name, out value))
                 {
                     LoopingSoundParameterUpdater.Sound sound = default(LoopingSoundParameterUpdater.Sound);
                     sound.ev          = data.ev;
                     sound.path        = data.path;
                     sound.description = soundEventDescription;
                     sound.transform   = data.transform;
                     LoopingSoundParameterUpdater.Sound sound2 = sound;
                     value.Remove(sound2);
                 }
             }
         }
         Get().sounds.Free(handle);
     }
 }
Пример #20
0
    public void Refresh()
    {
        UnregisterLight();
        Operational component = GetComponent <Operational>();

        if ((!((Object)component != (Object)null) || component.IsOperational) && base.isActiveAndEnabled)
        {
            Vector3 position = base.transform.GetPosition();
            position = new Vector3(position.x + Offset.x, position.y + Offset.y, position.z);
            int num = Grid.PosToCell(position);
            if (Grid.IsValidCell(num))
            {
                Vector2I vector2I = Grid.CellToXY(num);
                int      num2     = (int)Range;
                if (shape == LightShape.Circle)
                {
                    Vector2I vector2I2 = new Vector2I(vector2I.x - num2, vector2I.y - num2);
                    solidPartitionerEntry  = GameScenePartitioner.Instance.Add("Radiator", base.gameObject, vector2I2.x, vector2I2.y, 2 * num2, 2 * num2, GameScenePartitioner.Instance.solidChangedLayer, TriggerRefresh);
                    liquidPartitionerEntry = GameScenePartitioner.Instance.Add("Radiator", base.gameObject, vector2I2.x, vector2I2.y, 2 * num2, 2 * num2, GameScenePartitioner.Instance.liquidChangedLayer, TriggerRefresh);
                }
                else if (shape == LightShape.Cone)
                {
                    Vector2I vector2I3 = new Vector2I(vector2I.x - num2, vector2I.y - num2);
                    solidPartitionerEntry  = GameScenePartitioner.Instance.Add("Radiator", base.gameObject, vector2I3.x, vector2I3.y, 2 * num2, num2, GameScenePartitioner.Instance.solidChangedLayer, TriggerRefresh);
                    liquidPartitionerEntry = GameScenePartitioner.Instance.Add("Radiator", base.gameObject, vector2I3.x, vector2I3.y, 2 * num2, num2, GameScenePartitioner.Instance.liquidChangedLayer, TriggerRefresh);
                }
                cell = num;
                litCells.Clear();
                emitter = new RadiationGridEmitter(cell, litCells, Lux, Range, shape, 0.5f);
                emitter.Add();
                isRegistered = true;
            }
        }
    }
Пример #21
0
    public void SetData(HandleVector <int> .Handle handle, Header new_data0, ref Payload new_data1)
    {
        int index = ComputeIndex(handle);

        headers[index]  = new_data0;
        payloads[index] = new_data1;
    }
Пример #22
0
    protected override void OnSpawn()
    {
        if ((UnityEngine.Object)Def == (UnityEngine.Object)null)
        {
            Debug.LogError("Missing building definition on object " + base.name);
        }
        KSelectable component = GetComponent <KSelectable>();

        if ((UnityEngine.Object)component != (UnityEngine.Object)null)
        {
            component.SetName(Def.Name);
            component.SetStatusIndicatorOffset(new Vector3(0f, -0.35f, 0f));
        }
        Prioritizable component2 = GetComponent <Prioritizable>();

        if ((UnityEngine.Object)component2 != (UnityEngine.Object)null)
        {
            component2.iconOffset.y = 0.3f;
        }
        KPrefabID component3 = GetComponent <KPrefabID>();

        if (component3.HasTag(RoomConstraints.ConstraintTags.IndustrialMachinery))
        {
            scenePartitionerEntry = GameScenePartitioner.Instance.Add(base.name, base.gameObject, GetExtents(), GameScenePartitioner.Instance.industrialBuildings, null);
        }
        if (Def.Deprecated && (UnityEngine.Object)GetComponent <KSelectable>() != (UnityEngine.Object)null)
        {
            KSelectable component4 = GetComponent <KSelectable>();
            deprecatedBuildingStatusItem = new StatusItem("BUILDING_DEPRECATED", "BUILDING", string.Empty, StatusItem.IconType.Info, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 129022);
            component4.AddStatusItem(deprecatedBuildingStatusItem, null);
        }
    }
    public void Close()
    {
        openCount = Mathf.Max(0, openCount - 1);
        if (openCount == 0 && DisplacesGas(doorType))
        {
            StructureTemperatureComponents structureTemperatures = GameComps.StructureTemperatures;
            HandleVector <int> .Handle     handle = structureTemperatures.GetHandle(base.gameObject);
            PrimaryElement component = GetComponent <PrimaryElement>();
            if (handle.IsValid() && !structureTemperatures.IsBypassed(handle))
            {
                float num = component.Temperature = structureTemperatures.GetPayload(handle).Temperature;
            }
        }
        switch (controlState)
        {
        case ControlState.Locked:
            controller.sm.isOpen.Set(false, controller);
            break;

        case ControlState.Auto:
            if (openCount == 0)
            {
                controller.sm.isOpen.Set(false, controller);
                Game.Instance.userMenu.Refresh(base.gameObject);
            }
            break;
        }
    }
Пример #24
0
    protected override void OnSpawn()
    {
        HandleVector <Game.CallbackInfo> .Handle callbackHandle = Game.Instance.callbackManager.Add(new Game.CallbackInfo(OnModifyComplete, false));
        int   num           = building.Def.PlacementOffsets.Length;
        float mass_per_cell = primaryElement.Mass / (float)num;

        building.RunOnArea(delegate(int offset_cell)
        {
            if (doReplaceElement)
            {
                SimMessages.ReplaceAndDisplaceElement(offset_cell, primaryElement.ElementID, CellEventLogger.Instance.SimCellOccupierOnSpawn, mass_per_cell, primaryElement.Temperature, primaryElement.DiseaseIdx, primaryElement.DiseaseCount, callbackHandle.index);
                callbackHandle = HandleVector <Game.CallbackInfo> .InvalidHandle;
                SimMessages.SetStrength(offset_cell, 0, strengthMultiplier);
                Game.Instance.RemoveSolidChangedFilter(offset_cell);
            }
            else
            {
                ForceSetGameCellData(offset_cell);
                Game.Instance.AddSolidChangedFilter(offset_cell);
            }
            Sim.Cell.Properties simCellProperties = GetSimCellProperties();
            SimMessages.SetCellProperties(offset_cell, (byte)simCellProperties);
            Grid.RenderedByWorld[offset_cell] = false;
            Game.Instance.GetComponent <EntombedItemVisualizer>().ForceClear(offset_cell);
        });
        Subscribe(-1699355994, OnBuildingRepairedDelegate);
    }
    protected override void OnSpawn()
    {
        base.OnSpawn();
        ScenePartitionerLayer scenePartitionerLayer = null;
        Building component = GetComponent <Building>();

        utilityCell = component.GetUtilityOutputCell();
        conduitType = component.Def.OutputConduitType;
        switch (component.Def.OutputConduitType)
        {
        case ConduitType.Gas:
            scenePartitionerLayer = GameScenePartitioner.Instance.gasConduitsLayer;
            break;

        case ConduitType.Liquid:
            scenePartitionerLayer = GameScenePartitioner.Instance.liquidConduitsLayer;
            break;

        case ConduitType.Solid:
            scenePartitionerLayer = GameScenePartitioner.Instance.solidConduitsLayer;
            break;
        }
        UpdateConnectionState(true);
        UpdatePipeRoomState(true);
        if (scenePartitionerLayer != null)
        {
            partitionerEntry = GameScenePartitioner.Instance.Add("RequireOutputs", base.gameObject, utilityCell, scenePartitionerLayer, delegate
            {
                UpdateConnectionState(false);
            });
        }
        GetConduitFlow().AddConduitUpdater(UpdatePipeState, ConduitFlowPriority.First);
    }
    protected override void OnSpawn()
    {
        base.OnSpawn();
        int num = Grid.PosToCell(this);

        originalDigElement = Grid.Element[num];
        KSelectable component = GetComponent <KSelectable>();

        component.SetStatusItem(Db.Get().StatusItemCategories.Main, Db.Get().MiscStatusItems.WaitingForDig, null);
        UpdateColor(isReachable);
        Grid.Objects[num, 7] = base.gameObject;
        ChoreType chore_type = Db.Get().ChoreTypes.Dig;

        if (choreTypeIdHash.IsValid)
        {
            chore_type = Db.Get().ChoreTypes.GetByHash(choreTypeIdHash);
        }
        chore = new WorkChore <Diggable>(chore_type, this, null, true, null, null, null, true, null, false, true, null, true, true, true, PriorityScreen.PriorityClass.basic, 5, false, true);
        SetWorkTime(float.PositiveInfinity);
        partitionerEntry = GameScenePartitioner.Instance.Add("Diggable.OnSpawn", base.gameObject, Grid.PosToCell(this), GameScenePartitioner.Instance.solidChangedLayer, OnSolidChanged);
        OnSolidChanged(null);
        ReachabilityMonitor.Instance instance = new ReachabilityMonitor.Instance(this);
        instance.StartSM();
        Subscribe(493375141, OnRefreshUserMenuDelegate);
        handle = Game.Instance.Subscribe(-1523247426, UpdateStatusItem);
        Components.Diggables.Add(this);
    }
 public void StopAbsorbing()
 {
     if (absorberHandle.IsValid())
     {
         absorberHandle = Game.Instance.plantElementAbsorbers.Remove(absorberHandle);
     }
 }
Пример #28
0
 protected override void OnSpawn()
 {
     base.OnSpawn();
     accumulator = Game.Instance.accumulators.Add("Element", this);
     Subscribe(824508782, OnActiveChangedDelegate);
     SimRegister();
 }
Пример #29
0
 protected override void OnPrefabInit()
 {
     base.OnPrefabInit();
     filterable  = GetComponent <Filterable>();
     accumulator = Game.Instance.accumulators.Add("Source", this);
     InitializeStatusItems();
 }
    private static void OnMassChanged(HandleVector <int> .Handle handle, object other_data)
    {
        OreSizeVisualizerData data           = GameComps.OreSizeVisualizers.GetData(handle);
        PrimaryElement        primaryElement = data.primaryElement;
        float num = primaryElement.Mass;

        if (other_data != null)
        {
            Pickupable     pickupable = (Pickupable)other_data;
            PrimaryElement component  = pickupable.GetComponent <PrimaryElement>();
            num += component.Mass;
        }
        MassTier massTier = default(MassTier);

        for (int i = 0; i < MassTiers.Length; i++)
        {
            if (num <= MassTiers[i].massRequired)
            {
                massTier = MassTiers[i];
                break;
            }
        }
        KBatchedAnimController component2 = primaryElement.GetComponent <KBatchedAnimController>();

        component2.Play(massTier.animName, KAnim.PlayMode.Once, 1f, 0f);
        KCircleCollider2D component3 = primaryElement.GetComponent <KCircleCollider2D>();

        if ((UnityEngine.Object)component3 != (UnityEngine.Object)null)
        {
            component3.radius = massTier.colliderRadius;
        }
        primaryElement.Trigger(1807976145, null);
    }