Beispiel #1
0
        /// <summary>
        /// adds a customer to the end
        /// </summary>
        /// <param name="newCustomer"></param>
        public void AddToQueue(CustomerNode newCustomer)
        {
            //if there are no customers
            if (amountOfCustomers == 0)
            {
                //the first customer is set to the new customer
                firstCustomer = newCustomer;
            }
            else
            {
                //temp variable ot store the customers
                CustomerNode currentCustomer = firstCustomer;

                //checking until the final customer
                for (int i = 0; i < amountOfCustomers - 1; i++)
                {
                    //going to the next customer
                    currentCustomer = currentCustomer.GetNextCustomer();
                }

                //adding a customer to the end of the queue
                currentCustomer.SetNextCustomer(newCustomer);
            }

            //increasing the number of customers
            amountOfCustomers++;
        }
Beispiel #2
0
        /// <summary>
        /// removes the front customer
        /// </summary>
        public void RemoveHead()
        {
            //if there is at least one customer
            if (amountOfCustomers > 0)
            {
                //the first customer is set to the next customer
                firstCustomer = firstCustomer.GetNextCustomer();

                //decreasing the number of customers
                amountOfCustomers--;
            }
        }
Beispiel #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="gameTime"></param>
        public void Update(GameTime gameTime)
        {
            //temp variable for the customers
            CustomerNode currentCustomer = firstCustomer;

            //checking each customer
            for (int i = 0; i < amountOfCustomers; i++)
            {
                //upadting each customer
                currentCustomer.UpdateCustomer(gameTime, false);

                //getting the next customer
                currentCustomer = currentCustomer.GetNextCustomer();
            }
        }