Beispiel #1
0
    protected override void OnPaintCell(int cell, int distFromOrigin)
    {
        base.OnPaintCell(cell, distFromOrigin);
        recentlyAffectedCells.Add(cell);
        if (!recentAffectedCellColor.ContainsKey(cell))
        {
            recentAffectedCellColor.Add(cell, settings.Element.substance.uiColour);
        }
        else
        {
            recentAffectedCellColor[cell] = settings.Element.substance.uiColour;
        }
        Game.CallbackInfo item = new Game.CallbackInfo(delegate
        {
            recentlyAffectedCells.Remove(cell);
            recentAffectedCellColor.Remove(cell);
        }, false);
        int              index       = Game.Instance.callbackManager.Add(item).index;
        int              gameCell    = cell;
        SimHashes        id          = settings.Element.id;
        CellElementEvent sandBoxTool = CellEventLogger.Instance.SandBoxTool;
        float            mass        = settings.Mass;
        float            temperature = settings.temperature;
        int              callbackIdx = index;

        SimMessages.ReplaceElement(gameCell, id, sandBoxTool, mass, temperature, Db.Get().Diseases.GetIndex(settings.Disease.IdHash), settings.diseaseCount, callbackIdx);
        SetBrushSize(brushRadius);
    }
    protected override void OnPaintCell(int cell, int distFromOrigin)
    {
        base.OnPaintCell(cell, distFromOrigin);
        recentlyAffectedCells.Add(cell);
        Game.CallbackInfo item = new Game.CallbackInfo(delegate
        {
            recentlyAffectedCells.Remove(cell);
        }, false);
        int              index       = Game.Instance.callbackManager.Add(item).index;
        int              gameCell    = cell;
        SimHashes        new_element = SimHashes.Vacuum;
        CellElementEvent sandBoxTool = CellEventLogger.Instance.SandBoxTool;
        float            mass        = 0f;
        float            temperature = 0f;
        int              callbackIdx = index;

        SimMessages.ReplaceElement(gameCell, new_element, sandBoxTool, mass, temperature, Db.Get().Diseases.GetIndex(settings.Disease.IdHash), 0, callbackIdx);
        HashSetPool <GameObject, SandboxDestroyerTool> .PooledHashSet pooledHashSet = HashSetPool <GameObject, SandboxDestroyerTool> .Allocate();

        foreach (Pickupable item2 in Components.Pickupables.Items)
        {
            if (Grid.PosToCell(item2) == cell)
            {
                pooledHashSet.Add(item2.gameObject);
            }
        }
        foreach (BuildingComplete item3 in Components.BuildingCompletes.Items)
        {
            if (Grid.PosToCell(item3) == cell)
            {
                pooledHashSet.Add(item3.gameObject);
            }
        }
        if ((Object)Grid.Objects[cell, 1] != (Object)null)
        {
            pooledHashSet.Add(Grid.Objects[cell, 1]);
        }
        foreach (Crop item4 in Components.Crops.Items)
        {
            if (Grid.PosToCell(item4) == cell)
            {
                pooledHashSet.Add(item4.gameObject);
            }
        }
        foreach (Health item5 in Components.Health.Items)
        {
            if (Grid.PosToCell(item5) == cell)
            {
                pooledHashSet.Add(item5.gameObject);
            }
        }
        foreach (GameObject item6 in pooledHashSet)
        {
            Util.KDestroyGameObject(item6);
        }
        pooledHashSet.Recycle();
    }
Beispiel #3
0
 public void Release()
 {
     if (handle.IsValid())
     {
         Game.CallbackInfo item = Game.Instance.callbackManager.GetItem(handle);
         System.Action     cb   = item.cb;
         if (!item.manuallyRelease)
         {
             Game.Instance.callbackManager.Release(handle);
         }
         cb();
     }
 }
    private void PaintCell(int cell)
    {
        recentlyAffectedCells.Add(cell);
        Game.CallbackInfo item = new Game.CallbackInfo(delegate
        {
            recentlyAffectedCells.Remove(cell);
        }, false);
        int              index       = Game.Instance.callbackManager.Add(item).index;
        int              gameCell    = cell;
        SimHashes        id          = settings.Element.id;
        CellElementEvent sandBoxTool = CellEventLogger.Instance.SandBoxTool;
        float            mass        = settings.Mass;
        float            temperature = settings.temperature;
        int              callbackIdx = index;

        SimMessages.ReplaceElement(gameCell, id, sandBoxTool, mass, temperature, Db.Get().Diseases.GetIndex(settings.Disease.IdHash), settings.diseaseCount, callbackIdx);
    }
 protected override void OnPaintCell(int cell, int distFromOrigin)
 {
     base.OnPaintCell(cell, distFromOrigin);
     if (!recentlyAffectedCells.Contains(cell))
     {
         recentlyAffectedCells.Add(cell);
         Game.CallbackInfo item = new Game.CallbackInfo(delegate
         {
             recentlyAffectedCells.Remove(cell);
         }, false);
         int   index = Game.Instance.callbackManager.Add(item).index;
         float num   = Grid.Temperature[cell];
         num += SandboxToolParameterMenu.instance.settings.temperatureAdditive;
         num  = Mathf.Clamp(num, 1f, 9999f);
         int              gameCell    = cell;
         SimHashes        id          = Grid.Element[cell].id;
         CellElementEvent sandBoxTool = CellEventLogger.Instance.SandBoxTool;
         float            mass        = Grid.Mass[cell];
         float            temperature = num;
         int              callbackIdx = index;
         SimMessages.ReplaceElement(gameCell, id, sandBoxTool, mass, temperature, Grid.DiseaseIdx[cell], Grid.DiseaseCount[cell], callbackIdx);
     }
 }