Beispiel #1
0
    public int[] GetNonEmptyMatterSlots()
    {
        int        max   = MatterExtensions.MaxMatter();
        List <int> slots = new List <int>();

        for (int i = 0; i < max; i++)
        {
            if (MatterIndexedResourceLists[i] != null && MatterIndexedResourceLists[i].Sum(x => x.Data.Container.CurrentAmount) > 0f)
            {
                slots.Add(i);
            }
        }
        return(slots.ToArray());
    }
Beispiel #2
0
    private void AttachTo(Collider c, string valveTag)
    {
        connectedPumpable = c.transform.root.GetComponent <IPumpable>();
        connectedSink     = connectedPumpable as ISink;
        print("valve mode: " + ValveMode);
        print("pump mode: " + PumpMode);

        if (connectedPumpable != null)
        {
            valveType = MatterExtensions.FromValveTag(valveTag);
            SyncMeshesToMatterType();
            this.SnapCrate(c.transform, c.transform.position + (c.transform.TransformDirection(Vector3.forward) * 1.3f));
            IndustryExtensions.AddAdjacentPumpable(this, connectedPumpable);
            RefreshPumpState();
        }
    }
Beispiel #3
0
 public ResourceList(Action <List <ResourceComponent> > OnResourcesDepleted)
 {
     this.onResourcesDepleted        = OnResourcesDepleted;
     this.MatterIndexedResourceLists = new List <ResourceComponent> [MatterExtensions.MaxMatter()];
 }