Exemplo n.º 1
0
        /// <summary>
        /// Receiving an input source from an InputModule
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected override void InputModule_NewSource(object sender, SourceEventArgs e)
        {
            Source inputSource = e.IncomingSource;

            inputSource.SetCurrentParent(this);
            TemporarilyStoreSource(inputSource);
            DataChanged(GetStats());
        }
Exemplo n.º 2
0
        protected override void InputModule_NewSource(object sender, SourceEventArgs e)
        {
            Source inputSource = e.IncomingSource;

            inputSource.SetCurrentParent(this);
            _newSource         = inputSource;
            _receivedNewSource = true;
            DataChanged(GetStats());
        }
Exemplo n.º 3
0
 protected override void InputModule_NewSource(object sender, SourceEventArgs e)
 {
     if (e.ReceivingModule == this)
     {
         Source inputSource = e.IncomingSource;
         inputSource.SetCurrentParent(this);
         _receivedSources.Enqueue(inputSource);
         _newSourceReceived = true;
         _nSourcesReceived++;
         DataChanged(GetStats());
     }
 }
Exemplo n.º 4
0
        protected override void InputModule_NewSource(object sender, SourceEventArgs e)
        {
            // Since I'm a conveyor, if I am one of the multiple output modules of a module,
            // I could be receiving a notification for a Source that is not for me. I need to check.
            if (e.ReceivingModule != this)
            {
#if DEBUG_PRINT
                Debug.Log("[" + name + "] This Source is not for me.");
#endif
                return;
            }
#if DEBUG_PRINT
            Debug.Log("[" + name + "] received new source from " +
                      e.EmittingModule.name + ": " + e.IncomingSource.name);
#endif
            Source inputSource = e.IncomingSource;
            inputSource.SetCurrentParent(this, false, false);
            _sourcesOnConveyor.Enqueue(inputSource);
            _lastAddedSource = inputSource;
            _newSourceAdded  = true;
            DataChanged(GetStats());
        }
        protected override void InputModule_NewSource(object sender, SourceEventArgs e)
        {
            Source inputSource = e.IncomingSource;

            inputSource.SetCurrentParent(this);
            // if the Assembler takes the same type of input, put the source alternatively
            if (_sourceType1 == _sourceType2)
            {
                int x = queueSwitchCounter % 2;
                if (x == 0)
                {
                    _firstInputSourcesQueue.Enqueue(inputSource);
                }
                else
                {
                    _secondInputSourcesQueue.Enqueue(inputSource);
                }
                queueSwitchCounter++;
            }
            else
            {
                if (inputSource.Type == _sourceType1)
                {
                    _firstInputSourcesQueue.Enqueue(inputSource);
                }
                else if (inputSource.Type == _sourceType2)
                {
                    _secondInputSourcesQueue.Enqueue(inputSource);
                }
                else
                {
                    Debug.LogError("[" + name + "] not receiving the expected type of source: " + inputSource.name + " " + inputSource.Type);
                }
            }
            DataChanged(GetStats());
        }