Inheritance: MonoBehaviour
Exemplo n.º 1
0
    /// <summary>
    /// Tyler Coppenbarger
    /// Starts the bottlenecking system by stopping all flockers, then starting the first flocker on the list to cross the bridge
    /// Also checks which side of the bridge the flock is on and sets the variables accordingly
    /// </summary>
    public void StartBottlenecking(Bottleneck passing, Vector2 firstCheck)
    {
        waitingPoint      = firstCheck;
        runningBottleneck = true;
        passingID         = 0;
        lastStartedID     = 0;
        toPass            = passing;

        if (FarthestReachFromPoint(firstCheck) < 5)
        {
            WaitStart();
            waitingForFlock = false;
        }
        else
        {
            waitingForFlock = true;
            for (int i = 0; i < allFlock.Count; i++)
            {
                float distTest = Vector2.Distance(firstCheck, new Vector2(allFlock[i].transform.position.x, allFlock[i].transform.position.z));
                if (distTest < 5)
                {
                    allFlock[i].State = Flock.FlockState.Stopped;
                }
            }
        }
    }
Exemplo n.º 2
0
        public BaseTasksCoordinator(ILoggerFactory loggerFactory, IMessageReaderFactory messageReaderFactory,
                                    int maxTasksCount, bool isQueueActivationEnabled = false, int maxReadParallelism = 4)
        {
            this.Logger = loggerFactory.CreateLogger(this.GetType().Name);
            // the current PrimaryReader does not use BottleNeck hence: maxReadParallelism - 1
            int throttleCount = Math.Max(maxReadParallelism - 1, 1);

            this._tasksCanBeStarted       = 0;
            this._stopTokenSource         = null;
            this._cancellationToken       = CancellationToken.None;
            this._readerFactory           = messageReaderFactory;
            this._maxTasksCount           = maxTasksCount;
            this.IsQueueActivationEnabled = isQueueActivationEnabled;
            this._taskIdSeq      = 0;
            this._tasks          = new ConcurrentDictionary <long, Task>();
            this._isStarted      = 0;
            this._readBottleNeck = new Bottleneck(throttleCount);
        }