예제 #1
0
        public override void RunOnClock()
        {
            if (GroupQueue.Count != 0 || CurrentGroup != null)
            {
                //  If CurrentGroup is 0, then we need to get a group.
                if (CurrentGroup == null)
                {
                    DequeueGroup();
                }
                //  If 'PeopleAllowedToMove' has reached member count. Then allow them to continue.
                if (1 <= PeopleAllowedToMove)
                {
                    CurrentGroup.RemoveAgents(1);
                    CurrentGroup.CurrentNode.RemoveAgents(1);
                    PeopleAllowedToMove--;
                }
                //  If not. Then we need to count it up with the flow rate of the door.
                PeopleAllowedToMove += GetFlowRate();

                if (CurrentGroup.MemberCount == 0)
                {
                    DequeueGroup();
                }
            }
            else
            {
                PeopleAllowedToMove = 0;
            }
        }