public void StartSequence(Flow flow)
        {
            if (coroutineInstances == null)
            {
                coroutineInstances = new AotList();
            }

            if (loopRoutines == null)
            {
                loopRoutines = new AotList();
            }

            if (!isRunning || async)
            {
                isRunning = true;

                coroutineInstance = CoroutineRunner.instance;
                loopRoutine       = coroutineInstance.ConvertTo <CoroutineRunner>().StartCoroutine(Loop());
                coroutineInstances.Add(coroutineInstance);
                loopRoutines.Add(loopRoutine);

                Flow _flow = Flow.New();
                _flow.Invoke(entered);
                _flow.Dispose();
            }
        }
        public void Enter(Flow flow)
        {
            IDictionary <Vector3, object> newDictionary = new Dictionary <Vector3, object>();

            foreach (KeyValuePair <Vector3, object> item in databaseIn.GetValue <Database>().cells)
            {
                if (item.Key.y < index.GetValue <int>())
                {
                    newDictionary.Add(new Vector3(item.Key.x, item.Key.y, item.Key.z), item.Value);
                }
                else
                {
                    if (item.Key.y >= index.GetValue <int>() + rows.GetValue <int>())
                    {
                        newDictionary.Add(new Vector3(item.Key.x, item.Key.y - rows.GetValue <int>(), item.Key.z), item.Value);
                    }
                }
            }

            newDatabase.cells   = newDictionary;
            newDatabase.rows    = databaseIn.GetValue <Database>().rows - rows.GetValue <int>();
            newDatabase.columns = databaseIn.GetValue <Database>().columns;
            newDatabase.depth   = databaseIn.GetValue <Database>().depth;

            Flow _flow = Flow.New();

            _flow.Invoke(exit);
            _flow.Dispose();
        }
Esempio n. 3
0
        public void Trigger(Flow flow)
        {
            Flow _flow = Flow.New();



            if (!ascend.GetValue <bool>())
            {
                if (count < controlOutputs.Count - 1)
                {
                    count++;
                }
                else
                {
                    count = 0;
                }
            }
            else
            {
                if (count > 0)
                {
                    count--;
                }
                else
                {
                    count = controlOutputs.Count - 1;
                }
            }

            _flow.Invoke(controlOutputs["control_" + count]);
            _flow.Dispose();
        }
        public void Trigger(Flow flow)
        {
            Flow _flow = Flow.New();

            if (!ascend.GetValue <bool>())
            {
                if (count < multiValueInputs.Count - 1)
                {
                    count++;
                }
                else
                {
                    count = 0;
                }
            }
            else
            {
                if (count > 0)
                {
                    count--;
                }
                else
                {
                    count = multiValueInputs.Count - 1;
                }
            }

            _flow.Invoke(exit);
            _flow.Dispose();
        }
        public IEnumerator Loop()
        {
            unscaledtime          = Time.unscaledTime;
            unscaledstartTime     = Time.unscaledTime;
            unscaledTimeElapsed   = 0f;
            unscaledTimeRemaining = delay.GetValue <float>();

            realTime          = Time.time;
            realStartTime     = Time.time;
            realTimeElapsed   = 0f;
            realTimeRemaining = delay.GetValue <float>();

            if (unscaled.GetValue <bool>())
            {
                while (unscaledTimeElapsed < delay.GetValue <float>())
                {
                    unscaledtime = Time.time;

                    unscaledTimeElapsed   = unscaledtime - unscaledstartTime;
                    unscaledTimeRemaining = delay.GetValue <float>() - unscaledTimeElapsed;


                    if (!destroyed)
                    {
                        Flow _loop = Flow.New();
                        _loop.Invoke(loop);
                        _loop.Dispose();
                    }

                    yield return(null);
                }
            }
            else
            {
                while (realTimeElapsed < delay.GetValue <float>())
                {
                    realTime = Time.time;

                    realTimeElapsed   = realTime - realStartTime;
                    realTimeRemaining = delay.GetValue <float>() - realTimeElapsed;

                    if (!destroyed)
                    {
                        Flow _loop = Flow.New();
                        _loop.Invoke(loop);
                        _loop.Dispose();
                    }

                    yield return(null);
                }
            }

            isRunning = false;

            Flow _exit = Flow.New();

            _exit.Invoke(exit);
            _exit.Dispose();
        }
        public void BreakSequence(Flow flow)
        {
            if (coroutineInstances != null)
            {
                destroyed = true;

                Flow _flow = Flow.New();
                _flow.Invoke(breakOut);
                _flow.Dispose();
            }
        }
        public void Enter(Flow flow)
        {
            IDictionary <Vector3, object> newDictionary = new Dictionary <Vector3, object>();

            bool after = true;

            foreach (KeyValuePair <Vector3, object> item in databaseIn.GetValue <Database>().cells)
            {
                if (item.Key.z < index.GetValue <int>())
                {
                    newDictionary.Add(item.Key, item.Value);
                }
                else
                {
                    if (item.Key.z == databaseIn.GetValue <Database>().depth)
                    {
                        after = false;
                    }
                    break;
                }
            }

            for (int h = 1; h <= databaseIn.GetValue <Database>().columns; h++)
            {
                for (int i = index.GetValue <int>(); i <= index.GetValue <int>() + depth.GetValue <int>(); i++)
                {
                    for (int j = 1; j <= databaseIn.GetValue <Database>().rows; j++)
                    {
                        newDictionary.Add(new Vector3(h, j, i), null);
                    }
                }
            }

            if (after)
            {
                foreach (KeyValuePair <Vector3, object> item in databaseIn.GetValue <Database>().cells)
                {
                    if (item.Key.z >= index.GetValue <int>())
                    {
                        newDictionary.Add(new Vector3(item.Key.x, item.Key.y, item.Key.z + depth.GetValue <int>()), item.Value);
                    }
                }
            }

            newDatabase.cells   = newDictionary;
            newDatabase.rows    = databaseIn.GetValue <Database>().rows;
            newDatabase.columns = databaseIn.GetValue <Database>().columns;
            newDatabase.depth   = databaseIn.GetValue <Database>().depth + depth.GetValue <int>();

            Flow _flow = Flow.New();

            _flow.Invoke(exit);
            _flow.Dispose();
        }
        public void Enter(Flow flow)
        {
            IDictionary <Vector3, object> ADictionary = new Dictionary <Vector3, object>();
            IDictionary <Vector3, object> BDictionary = new Dictionary <Vector3, object>();

            int _depth     = 0;
            int _tempDepth = 0;

            foreach (KeyValuePair <Vector3, object> item in databaseIn.GetValue <Database>().cells)
            {
                if (item.Key.z < index.GetValue <int>())
                {
                    ADictionary.Add(new Vector3(item.Key.x, item.Key.y, item.Key.z), item.Value);
                }
                else
                {
                    if (item.Key.z >= index.GetValue <int>())
                    {
                        if (_tempDepth != item.Key.z.ConvertTo <int>())
                        {
                            _tempDepth = item.Key.z.ConvertTo <int>();
                            _depth++;
                        }
                        BDictionary.Add(new Vector3(item.Key.x, item.Key.y, _depth), item.Value);
                    }
                }
            }

            int BCount = _depth;
            int ACount = databaseIn.GetValue <Database>().depth - _depth;



            A.cells   = ADictionary;
            A.depth   = ACount;
            A.columns = databaseIn.GetValue <Database>().columns;
            A.rows    = databaseIn.GetValue <Database>().rows;

            B.cells   = BDictionary;
            B.depth   = BCount;
            B.columns = databaseIn.GetValue <Database>().columns;
            B.rows    = databaseIn.GetValue <Database>().rows;

            Flow _flow = Flow.New();

            _flow.Invoke(exit);
            _flow.Dispose();
        }
Esempio n. 9
0
        private void Combine(Flow flow)
        {
            connectionCount = enter.connectedPorts.ToListPooled().Count;


            if (!addedConnectedPorts)
            {
                controlConnections = new Dictionary <ControlConnection, bool>();

                for (int i = 0; i < enter.validConnectedPorts.ToListPooled().Count; i++)
                {
                    controlConnections.Add(enter.validConnectedPorts.ToListPooled()[i].connection, false);
                }

                addedConnectedPorts = true;
            }

            foreach (ControlConnection key in controlConnections.Keys.ToListPooled())
            {
                if (lastInvokeFrame >= lastInvokedFrame)
                {
                    if (!controlConnections[key])
                    {
                        controlConnections[key] = true;
                        currentConnections++;
                    }
                }
            }

            if (currentConnections == connectionCount - 1)
            {
                Debug.Log("FINISHED");
                canExit = true;
            }

            if (canExit == true)
            {
                Flow _flow = Flow.New();
                _flow.Invoke(exit);
                _flow.Dispose();
                currentConnections = 0;
                canExit            = false;
            }
        }
Esempio n. 10
0
        public void Enter(Flow flow)
        {
            IDictionary <Vector3, object> newDictionary = new Dictionary <Vector3, object>();

            foreach (KeyValuePair <Vector3, object> item in databaseIn.GetValue <Database>().cells)
            {
                newDictionary.Add(item.Key, null);
            }

            newDatabase.cells   = newDictionary;
            newDatabase.rows    = databaseIn.GetValue <Database>().rows;
            newDatabase.columns = databaseIn.GetValue <Database>().columns;
            newDatabase.depth   = databaseIn.GetValue <Database>().depth;

            Flow _flow = Flow.New();

            _flow.Invoke(exit);
            _flow.Dispose();
        }
        public IEnumerator Loop()
        {
            while (condition.GetValue <bool>())
            {
                if (!destroyed)
                {
                    Flow _loop = Flow.New();
                    _loop.Invoke(loop);
                    _loop.Dispose();
                }

                yield return(null);
            }

            isRunning = false;
            Flow _exit = Flow.New();

            _exit.Invoke(exit);
            _exit.Dispose();
        }
 private void Enter(Flow flow)
 {
     newDatabase = databaseIn.GetValue <Database>();
     if (newDatabase.cells.Keys.Contains(new Vector3(column.GetValue <int>(), row.GetValue <int>(), depth.GetValue <int>())))
     {
         newDatabase.cells[new Vector3(column.GetValue <int>(), row.GetValue <int>(), depth.GetValue <int>())] = value.GetValue <object>();
         Flow _flow = Flow.New();
         _flow.Invoke(exit);
         _flow.Dispose();
     }
     else
     {
         if (row.GetValue <int>() <= 0 || column.GetValue <int>() <= 0 || depth.GetValue <int>() <= 0)
         {
             throw new NullReferenceException("You can't have a 0 row, 0 column, or 0 depth database.");
         }
         else
         {
             throw new NullReferenceException("Cell in column '" + column.ToString() + "', row '" + row.ToString() + "', depth '" + depth.ToString() + "' does not exist.You do not have enough rows or columns.");
         }
     }
 }
Esempio n. 13
0
        public void Enter(Flow flow)
        {
            if (index.GetValue <int>() > databaseIn.GetValue <Database>().rows)
            {
                throw new ArgumentOutOfRangeException();
            }
            else
            {
                IDictionary <Vector3, object> newDictionary = new Dictionary <Vector3, object>();
                bool after = true;

                foreach (KeyValuePair <Vector3, object> item in databaseIn.GetValue <Database>().cells)
                {
                    if (item.Key.y < index.GetValue <int>())
                    {
                        newDictionary.Add(item.Key, item.Value);
                    }
                    else
                    {
                        if (item.Key.y == databaseIn.GetValue <Database>().rows)
                        {
                            after = false;
                        }
                        break;
                    }
                }


                for (int h = 1; h <= databaseIn.GetValue <Database>().depth; h++)
                {
                    for (int i = index.GetValue <int>(); i <= index.GetValue <int>() + rows.GetValue <int>(); i++)
                    {
                        for (int j = 1; j <= databaseIn.GetValue <Database>().columns; j++)
                        {
                            newDictionary.Add(new Vector3(j, i, h), null);
                        }
                    }
                }


                if (after)
                {
                    foreach (KeyValuePair <Vector3, object> item in databaseIn.GetValue <Database>().cells)
                    {
                        if (item.Key.y > index.GetValue <int>())
                        {
                            newDictionary.Add(new Vector3(item.Key.x, item.Key.y + rows.GetValue <int>(), item.Key.z), item.Value);
                        }
                    }
                }

                newDatabase.cells   = newDictionary;
                newDatabase.rows    = databaseIn.GetValue <Database>().rows + rows.GetValue <int>();
                newDatabase.columns = databaseIn.GetValue <Database>().columns;
                newDatabase.depth   = databaseIn.GetValue <Database>().depth;

                Flow _flow = Flow.New();
                _flow.Invoke(exit);
                _flow.Dispose();
            }
        }