コード例 #1
0
        private void GetVents()
        {
            ventList.Clear();

            foreach (MapEntity entity in item.linkedTo)
            {
                Item linkedItem = entity as Item;
                if (linkedItem == null)
                {
                    continue;
                }

                Vent vent = linkedItem.GetComponent <Vent>();
                if (vent == null)
                {
                    continue;
                }

                ventList.Add(vent);
                if (linkedItem.CurrentHull != null)
                {
                    totalHullVolume += linkedItem.CurrentHull.Volume;
                }
            }
        }
コード例 #2
0
        private void GetVents()
        {
            ventList = new Dictionary <Vent, float>();
            foreach (MapEntity entity in item.linkedTo)
            {
                if (!(entity is Item linkedItem))
                {
                    continue;
                }

                Vent vent = linkedItem.GetComponent <Vent>();
                if (vent?.Item.CurrentHull == null)
                {
                    continue;
                }

                ventList.Add(vent, 0.0f);
                foreach (Hull connectedHull in vent.Item.CurrentHull.GetConnectedHulls(includingThis: true, searchDepth: 10, ignoreClosedGaps: true))
                {
                    totalHullVolume += connectedHull.Volume;
                    ventList[vent]  += connectedHull.Volume;
                }
            }
        }