コード例 #1
0
            public MyPhysicalDistributionGroup(MyDefinitionId typeId, MyResourceSourceComponent tempConnectedSource)
            {
                SinksByPriority = null; SourcesByPriority = null; SinkSourcePairs = null; FirstEndpoint = null;
                SinkDataByPriority = null; SourceDataByPriority = null; StockpilingStorage = null; OtherStorage = null;
                InputOutputData = new MyTuple<MySinkGroupData, MySourceGroupData>();
                MaxAvailableResources = 0f; ResourceState = MyResourceStateEnum.NoPower;
                AllocateData();

                InitFromTempConnected(typeId, tempConnectedSource);
            }
コード例 #2
0
			public MyPhysicalDistributionGroup(MyDefinitionId typeId, IMyConveyorEndpointBlock block)
			{
			    SinksByPriority = null; SourcesByPriority = null; SinkSourcePairs = null; FirstEndpoint = null;
				SinkDataByPriority = null; SourceDataByPriority = null; StockpilingStorage = null; OtherStorage = null;
				InputOutputData = new MyTuple<MySinkGroupData, MySourceGroupData>();
				MaxAvailableResources = 0f; ResourceState = MyResourceStateEnum.NoPower;
				AllocateData();

				Init(typeId, block);
			}
コード例 #3
0
        public override void UpdateAfterSimulation10()
        {
            base.UpdateAfterSimulation10();
            if (CubeGrid.GridSystems.ResourceDistributor.ResourceState != m_oldResourceState)
            {
                m_oldResourceState = CubeGrid.GridSystems.ResourceDistributor.ResourceState;
                UpdateEmissivity();
            }

            m_oldResourceState = CubeGrid.GridSystems.ResourceDistributor.ResourceState;
        }
コード例 #4
0
 public override void UpdateBeforeSimulation100()
 {
     if (this.m_segment.ConveyorLine != null)
     {
         MyResourceStateEnum enum2 = this.m_segment.ConveyorLine.UpdateIsWorking();
         if ((!this.m_emissivitySet || (this.m_working != this.m_segment.ConveyorLine.IsWorking)) || (this.m_state != enum2))
         {
             this.m_working = this.m_segment.ConveyorLine.IsWorking;
             this.m_state   = enum2;
             this.SetEmissiveStateWorking();
         }
     }
 }
コード例 #5
0
        public override void UpdateBeforeSimulation100()
        {
            base.UpdateBeforeSimulation100();
            if (m_soundEmitter == null)
            {
                return;
            }

            if (m_needsRefresh)
            {
                RefreshConnections();
                m_needsRefresh = false;
            }

            if (CubeGrid.GridSystems.ResourceDistributor.ResourceState != m_oldResourceState)
            {
                m_oldResourceState = CubeGrid.GridSystems.ResourceDistributor.ResourceState;
                UpdateEmissivity();
            }

            m_oldResourceState = CubeGrid.GridSystems.ResourceDistributor.ResourceState;

            bool powered = false;

            foreach (var block in m_connectedBlocks.Values)
            {
                powered |= block != null && block.ResourceSink != null && block.ResourceSink.IsPoweredByType(MyResourceDistributorComponent.ElectricityId) && block.IsWorking;
                if (powered)
                {
                    break;
                }
            }
            powered &= IsWorking;

            if (powered && m_connectedBlockCount > 0 && (m_soundEmitter.IsPlaying == false || m_soundEmitter.SoundPair != m_baseIdleSound))
            {
                m_soundEmitter.PlaySound(m_baseIdleSound, true);
            }
            else if ((!powered || m_connectedBlockCount == 0) && m_soundEmitter.IsPlaying && m_soundEmitter.SoundPair == m_baseIdleSound)
            {
                m_soundEmitter.StopSound(false);
            }
        }
コード例 #6
0
 void PowerDistributor_PowerStateChaged(MyResourceStateEnum newState)
 {
     UpdateIsWorking();
     UpdateEmissivity();
 }
コード例 #7
0
        public override void UpdateAfterSimulation10()
        {
            base.UpdateAfterSimulation10();
            if (CubeGrid.GridSystems.ResourceDistributor.ResourceState != m_oldResourceState)
            {
                m_oldResourceState = CubeGrid.GridSystems.ResourceDistributor.ResourceState;
                UpdateEmissivity();
            }

            m_oldResourceState = CubeGrid.GridSystems.ResourceDistributor.ResourceState;
        }
コード例 #8
0
 void PowerDistributor_PowerStateChaged(MyResourceStateEnum newState)
 {
     UpdateIsWorking();
     UpdateEmissivity();
 }