Exemplo n.º 1
0
    private void PopulateEntombedItemVisualizers()
    {
        EntombedItemVisualizer component = Game.Instance.GetComponent <EntombedItemVisualizer>();

        foreach (int cell in cells)
        {
            component.AddItem(cell);
        }
    }
Exemplo n.º 2
0
    private void SpawnObjects(List <int> uncovered_item_indices)
    {
        uncovered_item_indices.Sort();
        uncovered_item_indices.Reverse();
        EntombedItemVisualizer component = Game.Instance.GetComponent <EntombedItemVisualizer>();

        foreach (int uncovered_item_index in uncovered_item_indices)
        {
            Item item = GetItem(uncovered_item_index);
            component.RemoveItem(item.cell);
            RemoveItem(uncovered_item_index);
            SimHashes elementId = (SimHashes)item.elementId;
            ElementLoader.FindElementByHash(elementId)?.substance.SpawnResource(Grid.CellToPosCCC(item.cell, Grid.SceneLayer.Ore), item.mass, item.temperature, item.diseaseIdx, item.diseaseCount, false, false, false);
        }
    }
Exemplo n.º 3
0
    public void Sim33ms(float dt)
    {
        EntombedItemVisualizer component = Game.Instance.GetComponent <EntombedItemVisualizer>();

        HashSetPool <Pickupable, EntombedItemManager> .PooledHashSet pooledHashSet = HashSetPool <Pickupable, EntombedItemManager> .Allocate();

        foreach (Pickupable pickupable in pickupables)
        {
            if (CanEntomb(pickupable))
            {
                pooledHashSet.Add(pickupable);
            }
        }
        pickupables.Clear();
        foreach (Pickupable item in pooledHashSet)
        {
            int            num          = Grid.PosToCell(item);
            PrimaryElement component2   = item.GetComponent <PrimaryElement>();
            SimHashes      elementID    = component2.ElementID;
            float          mass         = component2.Mass;
            float          temperature  = component2.Temperature;
            byte           diseaseIdx   = component2.DiseaseIdx;
            int            diseaseCount = component2.DiseaseCount;
            Element        element      = Grid.Element[num];
            if (elementID == element.id && mass > 0.0100000007f && Grid.Mass[num] + mass < element.maxMass)
            {
                SimMessages.AddRemoveSubstance(num, ElementLoader.FindElementByHash(elementID).idx, CellEventLogger.Instance.ElementConsumerSimUpdate, mass, temperature, diseaseIdx, diseaseCount, true, -1);
            }
            else
            {
                component.AddItem(num);
                cells.Add(num);
                elementIds.Add((int)elementID);
                masses.Add(mass);
                temperatures.Add(temperature);
                diseaseIndices.Add(diseaseIdx);
                diseaseCounts.Add(diseaseCount);
            }
            Util.KDestroyGameObject(item.gameObject);
        }
        pooledHashSet.Recycle();
    }