Example #1
0
 public Customer(int uid, string name)
 {
     this.Uid = uid;
     this.State = CustomerState.Inactive;
     this.Name = name;
     this.OrderHistory = new List<Order>();
 }
                public static bool IsSatisifedBy(CustomerState state)
                {
                    if (state == CustomerState.Created)
                    {
                        return true;
                    }

                    return false;
                }
Example #3
0
 public Customer(SerializationInfo info, StreamingContext ctxt)
 {
     this.Uid = (int)info.GetValue("Uid", typeof(int));
     this.State = (CustomerState)info.GetValue("State", typeof(CustomerState));
     this.Name = (string)info.GetValue("Name", typeof(string));
     this.Order = (Order)info.GetValue("Order", typeof(Order));
     this.Shop = (Shop)info.GetValue("Shop", typeof(Shop));
     this.OrderHistory = (List<Order>)info.GetValue("OrderHistory", typeof(List<Order>));
 }
                public static bool IsSatisifedBy(CustomerState state)
                {
                    if (state == CustomerState.DoesNotExist)
                    {
                        return true;
                    }

                    return false;
                }
        private SalesOrder CreateSaleOrder(CustomerState customerState)
        {
            var saleOrder = new SalesOrder();

            saleOrder.No                    = RandomString(7);
            saleOrder.Document_Type         = "Order";
            saleOrder.Sell_to_Customer_Name = customerState.Name;
            saleOrder.Sell_to_Address       = customerState.ShippingAddress;
            saleOrder.Sell_to_Post_Code     = customerState.PostCode;
            saleOrder.Sell_to_City          = customerState.City;
            return(saleOrder);
        }
Example #6
0
 protected virtual void Leaving()
 {
     if (MoveTowards(CustomerManager.instance.Entrance.position))
     {
         animator.SetBool("Walking", false);
         state = CustomerState.HasLeft;
     }
     else
     {
         animator.SetBool("Walking", true);
     }
 }
Example #7
0
        /// <summary>
        /// 删除客户状态
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public JsonResult CustomerState_remove(string id)
        {
            CustomerState en = new CustomerState();

            en.id = Convert.ToInt32(id);

            DaCustomerState dal    = new DaCustomerState();
            var             result = new CustomJsonResult();

            result.Data = dal.delete(en);
            return(result);
        }
Example #8
0
        public ddlState()
        {
            //获取所有状态
            CustomerState cusState  = CustomerState.NoInvite;
            var           stateList = cusState.GetSelectList("所有状态");

            this.DataSource     = stateList;
            this.DataTextField  = "Text";
            this.DataValueField = "Value";
            this.DataBind();
            this.CssClass = "form-control chosen-selects";
        }
Example #9
0
        public void Assert_that_customers_are_added_and_modified()
        {
            var store = ClientEventStore.Empty;
            var sut   = new CustomerState(store);

            sut.Execute(new AddCustomerCommand(Guid.Empty, "TestCustomer"));
            sut.Execute(new ModifyCustomerCommand(Guid.Empty, Option <string> .Some("NewValue")));

            Assert.AreEqual(1, sut.Customers.Count);
            Assert.AreEqual(Guid.Empty, sut.Customers[0].Id);
            Assert.AreEqual("NewValue", sut.Customers[0].Name);
        }
Example #10
0
        /// <summary>
        /// 获取客户进度状态
        /// </summary>
        /// <param name="Source"></param>
        /// <returns></returns>
        public string GetCustomerState(object Source)
        {
            if (Source != null)
            {
                int State = Source.ToString().ToInt32();

                CustomerState value = (CustomerState)State;
                string        name  = DisplayNameExtension.GetDisplayNames(CustomerState.NoInvite, value.ToString());
                return(name);
            }
            return("");
        }
Example #11
0
    public void NextState()
    {
        if (currentState != CustomerState.SEATING)
        {
            atDestination = false;
        }
        switch (currentState)
        {
        case CustomerState.ENTER:
            isWaiting = true;
            GamePlaySystem.Instance.AddCustomerToList(this);
            currentState = CustomerState.ORDER;
            break;

        case CustomerState.ORDER:
            isWaiting    = true;
            currentState = CustomerState.WAITING;
            break;

        case CustomerState.WAITING:
            isWaiting   = true;
            destination = null;
            popupSystem.CreatePopup(0);
            currentState = CustomerState.SEATING;
            break;

        case CustomerState.SEATING:
            drinkTimer = Random.Range(10f, 20f) * (1 - (GameSystem.Instance.workerUnlocks[3] * 0.15f));
            if (atDestination)
            {
                popupSystem.StartInteraction(drinkTimer);
            }
            currentState = CustomerState.CONSUMING;
            break;

        case CustomerState.CONSUMING:
            GamePlaySystem.Instance.AddSeatToList(destination);
            GamePlaySystem.Instance.LeavingCustomer(gameObject);
            destination = null;
            CalculateHappiness();
            currentState = CustomerState.LEAVE;
            break;

        case CustomerState.LEAVE:
            GamePlaySystem.Instance.DestroyCustomer(gameObject);
            break;

        default:
            Debug.Log("Error with NextState");
            break;
        }
    }
Example #12
0
 protected virtual void Arriving()
 {
     if (MoveTowards(spot.position))
     {
         animator.SetBool("Walking", false);
         //PlaceBasketOnCounter();
         state = CustomerState.WaitingForService;
     }
     else
     {
         animator.SetBool("Walking", true);
     }
 }
Example #13
0
 protected virtual void PickingUpBag()
 {
     if (MoveTowards(CustomerManager.instance.PickUpPosition.position))
     {
         animator.SetBool("Walking", false);
         PickUpBag();
         state = CustomerState.Leaving;
     }
     else
     {
         animator.SetBool("Walking", true);
     }
 }
Example #14
0
        /// <summary>
        /// 删除状态
        /// </summary>
        /// <param name="en">状态</param>
        /// <returns></returns>
        public int delete(CustomerState en)
        {
            string strSql = "delete from CustomerState where id=@id";

            SqlParameter[] param = new SqlParameter[]
            {
                new SqlParameter("@id", en.id)
            };

            int result = SqlHelper.ExecuteNonQuery(BaseHelper.DBConnStr, CommandType.Text, strSql, param);

            return(result);
        }
Example #15
0
        public JsonResult CustomerState_add(string state, string memo)
        {
            CustomerState en = new CustomerState();

            en.state = state;
            en.memo  = memo;

            DaCustomerState dal    = new DaCustomerState();
            var             result = new CustomJsonResult();

            result.Data = dal.add(en);
            return(result);
        }
Example #16
0
        public Customer(CustomerStart c)
        {
            state = CustomerState.Shopping;
            _id = _lastId;
            _lastId++;

            itemList = Item.GenerateRandomItems(c.items);

            shoppingCart = new List<Item>();
            purchasedItems = new List<Item>();

            _delay = c.delay;
            new Thread(new ThreadStart(this.Begin)).Start();
        }
Example #17
0
        /// <summary>
        /// 添加状态
        /// </summary>
        /// <param name="en">状态</param>
        /// <returns></returns>
        public int add(CustomerState en)
        {
            string strSql = "insert into CustomerState (state, memo) values (@state, @memo)";

            SqlParameter[] param = new SqlParameter[]
            {
                new SqlParameter("@state", en.state),
                new SqlParameter("@memo", en.memo)
            };

            int result = SqlHelper.ExecuteNonQuery(BaseHelper.DBConnStr, CommandType.Text, strSql, param);

            return(result);
        }
Example #18
0
        public JsonResult CustomerState_edit(string id, string state, string memo)
        {
            CustomerState en = new CustomerState();

            en.id    = Convert.ToInt32(id);
            en.state = state;
            en.memo  = memo;

            DaCustomerState dal    = new DaCustomerState();
            var             result = new CustomJsonResult();

            result.Data = dal.update(en);
            return(result);
        }
Example #19
0
 /// <summary>
 /// Cut customer hair by a certain amount.
 /// </summary>
 /// <param name="amount">Amount of hair to cut</param>
 /// <returns>If customer wants more cutting</returns>
 public bool CutHair(double amount)
 {
     if (state != CustomerState.Cutting)
     {
         return(false);
     }
     hairAmount = Math.Max(hairAmount - amount, 0);
     if (hairAmount <= TargetHairAmount)
     {
         state = CustomerState.Leaving;
         return(true);
     }
     return(false);
 }
Example #20
0
    // Update is called once per frame
    private void Update()
    {
        switch (state)
        {
        case CustomerState.AISLE_SEARCH:
            if (shoppingList.Count <= 0)
            {
                // Shopping list is empty
                if (inventory.Count <= 0)
                {
                    // Inventory is empty
                    // Reduce the customer happiness to 0 because every item this customer had on the shopping list was out of stock
                    stats.AddHappiness(-100);
                    state = CustomerState.LEAVE_SHOP;
                }
                else
                {
                    // Inventory has at least 1 item
                    state          = CustomerState.GO_TO_CHECKOUT;
                    targetCheckout = CheckoutManager.Instance.priorityCheckout;
                    targetCheckout.queue.Enqueue(gameObject);
                    currentQueuePosition        = targetCheckout.queue.Count - 1;
                    targetCheckoutQueuePosition = targetCheckout.queueSlots[currentQueuePosition].position;
                    break;
                }
            }
            TakeItemFromShelf();
            break;

        case CustomerState.GO_TO_CHECKOUT:
            WaitInQueue();
            break;

        case CustomerState.PUT_ITEMS_ON_CHECKOUT:
            PutItemsOnCheckout();
            break;

        case CustomerState.WAIT_FOR_ITEMS_TO_BE_SCANNED:
            CheckIfItemScanningFinished();
            break;

        case CustomerState.PAY:
            PayCashier();
            break;

        case CustomerState.LEAVE_SHOP:
            LeaveShop();
            break;
        }
    }
Example #21
0
        // Update is called once per frame
        private void FixedUpdate()
        {
            Debug.Log(mCustomerState.ToString());
            if (!mNavAgent.pathPending && mNavAgent.remainingDistance <= 0.1)
            {
                if (mCustomerState == CustomerState.Moving)
                {
                    //Set a random wait at the shelf for 1 - 3 seconds for slight realism
                    mCustomerState      = CustomerState.Waiting;
                    mWaitToGrabItemTime = RandomUtils.gRandom.Next(1, 3);
                }
                else if (mCustomerState == CustomerState.MovingToRegister)
                {
                    PurchaseItems();
                    LeaveStore();
                }
                else if (mCustomerState == CustomerState.Leaving)
                {
                    mCustomerManager.CustomerLeft(this);
                    Destroy(this.gameObject);
                }
            }

            if (mCustomerState == CustomerState.Waiting)
            {
                if (mWaitToGrabItemTime <= 0)
                {
                    mCustomerState = CustomerState.Purchasing;
                    RollToPurchaseFromShelf();
                }
                mWaitToGrabItemTime -= Time.deltaTime;
            }

            if (mCustomerState == CustomerState.Purchasing)
            {
                if (mItemsGrabbed == MaxPurchaseLimit || mPurchaseAttempts == MaxPurchaseAttempts)
                {
                    mCustomerState = CustomerState.GoToRegister;
                }
                else
                {
                    mCustomerState = CustomerState.GetShelf;
                }
            }

            if (mCustomerState == CustomerState.GoToRegister)
            {
                GoToRegister();
            }
        }
Example #22
0
        public Customer()
        {
            //TODO: Star Rating should be a weighted roll. Lower stars more likely than higher.
            //The star rating weight will also be used in the random rolls for money limit and buying cap.
            StarRating          = RandomUtils.gRandom.Next(1, 6);
            MoneyLimit          = 100;
            MaxPurchaseLimit    = 6;
            MaxPurchaseAttempts = 10;
            mPurchaseChance     = RandomUtils.gRandom.Next(40, 101);
            Array products = Enum.GetValues(typeof(ProductType));

            MostWantedProduct = (ProductType)products.GetValue(RandomUtils.gRandom.Next(0, products.Length));
            mCustomerState    = CustomerState.GetShelf;
        }
Example #23
0
    private void ProcessEnRouteToExitState()
    {
        if (HandleItemLoss())
        {
            return;
        }

        if (HandlePathProgress())
        {
            return;
        }

        currentState = CustomerState.Leaving;
    }
Example #24
0
        /// <summary>
        /// 修改状态
        /// </summary>
        /// <param name="en">状态</param>
        /// <returns></returns>
        public int update(CustomerState en)
        {
            string strSql = "update CustomerState set state=@state, memo=@memo where id=@id";

            SqlParameter[] param = new SqlParameter[]
            {
                new SqlParameter("@id", en.id),
                new SqlParameter("@state", en.state),
                new SqlParameter("@memo", en.memo)
            };

            int result = SqlHelper.ExecuteNonQuery(BaseHelper.DBConnStr, CommandType.Text, strSql, param);

            return(result);
        }
Example #25
0
 void Update()
 {
     if (currentState == CustomerState.EATING)
     {
         currentTime = currentTime + Time.deltaTime;
         if (currentTime >= EATING_TIME)
         {
             currentTime = 0.0f;
             OrderMarkerBG.SetActive(true);
             OrderMarker.SetActive(true);
             OrderMarker.GetComponent <SpriteRenderer>().sprite = MoneySprite;
             currentState = CustomerState.WAITING_TO_PAY;
         }
     }
 }
Example #26
0
    private void ProcessEnRouteToCashboxLineState()
    {
        // TODO: implement complex line handling logic
        if (HandleItemLoss())
        {
            return;
        }

        if (HandlePathProgress())
        {
            return;
        }

        currentState = CustomerState.Buying;
    }
Example #27
0
    public static int NumInState(CustomerState state)
    {
        int result = 0;

        Customer[] customers = FindObjectsOfType <Customer>();
        foreach (Customer customer in customers)
        {
            if (customer.State == state)
            {
                ++result;
            }
        }

        return(result);
    }
Example #28
0
 protected virtual void Ragequitting()
 {
     if (MoveTowards(CustomerManager.instance.Entrance.position))
     {
         animator.SetBool("Walking", false);
         state = CustomerState.HasLeft;
         if (Ragequit != null)
         {
             Ragequit();
         }
     }
     else
     {
         animator.SetBool("Walking", true);
     }
 }
Example #29
0
        public void Assert_events_are_synced()
        {
            var clientEventStore1 = ClientEventStore.Empty;
            var clientState1      = new CustomerState(clientEventStore1);
            var clientEventStore2 = ClientEventStore.Empty;
            var clientState2      = new CustomerState(clientEventStore2);
            var serverEventStore  = ServerEventStore.Empty;
            var serverState       = new CustomerState(serverEventStore);

            clientState1.Execute(new AddCustomerCommand(Guid.Empty, "TestCustomer"));
            clientState1.Execute(new ModifyCustomerCommand(Guid.Empty, Option <string> .Some("NewValue")));

            clientState2.Execute(new AddCustomerCommand(Guid.NewGuid(), "TestCustomer Number 2"));

            serverState.Execute(new AddCustomerCommand(Guid.NewGuid(), "TestCustomer Number 3"));

            // Sync
            var json1 = JsonConvert.SerializeObject(clientEventStore1.UnsyncedEvents, new JsonSerializerSettings {
                TypeNameHandling = TypeNameHandling.All
            });
            var changes1 = JsonConvert.DeserializeObject <ImmutableList <DomainEvent> >(json1, new JsonSerializerSettings {
                TypeNameHandling = TypeNameHandling.All
            });

            changes1.ForEach(serverEventStore.StoreEvent);

            var json2 = JsonConvert.SerializeObject(clientEventStore2.UnsyncedEvents, new JsonSerializerSettings {
                TypeNameHandling = TypeNameHandling.All
            });
            var changes2 = JsonConvert.DeserializeObject <ImmutableList <DomainEvent> >(json2, new JsonSerializerSettings {
                TypeNameHandling = TypeNameHandling.All
            });

            changes2.ForEach(serverEventStore.StoreEvent);

            clientEventStore1.ApplyChangesFromServer(
                serverEventStore.GetChangesSince(clientEventStore1.Events.LastOrDefault()?.EventId));
            clientEventStore2.ApplyChangesFromServer(
                serverEventStore.GetChangesSince(clientEventStore2.Events.LastOrDefault()?.EventId));

            Assert.IsTrue(clientState1.Customers.Count == clientState2.Customers.Count &&
                          clientState1.Customers.Count == serverState.Customers.Count);

            Assert.IsTrue(Enumerable.Range(0, clientState1.Customers.Count).All(i =>
                                                                                clientState1.Customers[i] == clientState2.Customers[i] &&
                                                                                clientState1.Customers[i] == serverState.Customers[i]));
        }
        /// <summary>
        /// Resolve SHIPPING CITY.
        /// </summary>
        private async Task <DialogTurnResult> ResolveShippingCity(
            WaterfallStepContext stepContext,
            CancellationToken cancellationToken)
        {
            CustomerState customerState =
                await _customerService.GetCustomerStateById(stepContext.Context.Activity.From.Id);

            var shippingCity = stepContext.Result as string;

            if (string.IsNullOrWhiteSpace(customerState.ShippingCity) && shippingCity != null)
            {
                customerState.ShippingCity = shippingCity;
                await _customerService.UpdateCustomerState(customerState);
            }

            return(await stepContext.NextAsync());
        }
Example #31
0
    protected virtual void WaitingForService()
    {
        if (CustomerManager.instance.CustomersServed < 4 && !basketPlaced)
        {
            PlaceBasketOnCounter();
            if (CustomerServed != null)
            {
                CustomerServed();
            }
            basketPlaced = true;
        }

        if (TimeManager.instance.CurrentTime()[0] >= 22 && !basketPlaced)
        {
            state = CustomerState.Leaving;
        }
    }
Example #32
0
    void Interact(Waiter waiter)
    {
        switch (state)
        {
        case CustomerState.WaitingToPlaceOrder:
        {
            State = CustomerState.PlacingOrder;
            break;
        }

        case CustomerState.WaitingForMeal:
        {
            TakeMeal(waiter);
            break;
        }
        }
    }
Example #33
0
    private void PayCashier()
    {
        targetCheckout.GetComponentInChildren <CheckoutScanner>().ResetCheckout();
        // Destory all shop items
        // Temporary, in future put items in shopping trolley
        int i;
        int totalElements = checkoutInventory.Count;

        for (i = 0; i < totalElements; i++)
        {
            Destroy(checkoutInventory.Peek().gameObject);
            checkoutInventory.Pop();
        }
        stats.AddHappiness(15.0f);
        targetCheckout.RemoveCustomerFromQueue();
        state = CustomerState.LEAVE_SHOP;
    }
        public async Task <bool> CreateOrder(CustomerState customerState)
        {
            var client = ODataClientSingleton.Get();

            try
            {
                var product = await client
                              .For <SalesOrder>("SalesOrder")
                              .Set(CreateSaleOrder(customerState))
                              .InsertEntryAsync();
            }
            catch (System.Net.Http.HttpRequestException e)
            {
                return(false);
            }

            return(true);
        }
Example #35
0
    void TakeMeal(Waiter waiter)
    {
        Meal meal = waiter.Meal;

        waiter.Meal = null;

        table.IncrementFoodBeingConsumed();

        switch (meal.NumCommonIngredients(desiredMeal))
        {
        case 3:
        {
            Mood += 10.0f;
            moodlet.ShowForSeconds(MoodletType.Happy, DEFAULT_MOODLET_TIME);
            break;
        }

        case 2:
        {
            Mood -= 10.0f;
            if (Mood > 0)
            {
                moodlet.ShowForSeconds(MoodletType.Unhappy, DEFAULT_MOODLET_TIME);
            }
            break;
        }

        default:
        {
            Mood -= 20.0f;
            if (Mood > 0)
            {
                audioSource.Play();
                moodlet.ShowForSeconds(MoodletType.Angry, DEFAULT_MOODLET_TIME);
            }
            break;
        }
        }

        if (State == CustomerState.WaitingForMeal)
        {
            State = CustomerState.EatingMeal;
        }
    }
Example #36
0
 public void RejectFromKebabBuilding()
 {
     if (state == CustomerState.Eating)
         StopEating();
     else
         state = CustomerState.Nothing;
 }
Example #37
0
 public void BuyAndStartEating()
 {
     KebabBuilding destinationKebabBuilding = (KebabBuilding)destinationBuilding;
     destinationKebabBuilding.customers.Add(this);
     state = CustomerState.Eating;
     eatingUntil = Time.time + EatDuration(hunger);
     destinationKebabBuilding.ChangeReputation(Settings.KebabBuilding_ReputationGainedFromSale);
     int profit = menuItemWantPriceWhenDecided - menuItemWant.GetProductionCost();
     destinationKebabBuilding.AddCashEarned(profit);
     menuItemWant.sales++;
     Debug.Log(string.Format("Sold {0} for a profit of {1}", menuItemWant.Name, profit));
 }
Example #38
0
    public void setState(CustomerState state)
    {
        if (state == _currentState)
            return;

        if (_statesMap[state].animName != "")
        {
            _sprite.Play(_statesMap[state].animName);
            //playAnim(_statesMap[state].animName);
        }

        switch(state)
        {
        default:
            Logger.message(LogLevel.LOG_ERROR, "Unknown customer state - "+state);
            break;
        }

        _currentState = state;
    }
Example #39
0
 public void StopEating()
 {
     mood = CustomerMood.Normal;
     state = CustomerState.Nothing;
     hunger = 0;
     SetMoveSpeed();
     KebabBuilding destinationKebabBuilding = (KebabBuilding)destinationBuilding;
     if (!destinationKebabBuilding.customers.Remove(this))
         throw new Exception("Did not find customer in kebab building customer list when removing it.");
     DecideDestinationAndPath();
 }
 public void Apply(CustomerRemovedByUser @event)
 {
     this.State = CustomerState.Removed;
 }
 public void Apply(CustomerCreatedByUser @event)
 {
     this.State = CustomerState.Created;
     this.Name = @event.Name;
 }
Example #42
0
 public void ReceiveOrder()
 {
     this.State = CustomerState.Inactive;
     this.Order.Receive();
 }
Example #43
0
    private bool DecideIfJoinQueue(KebabBuilding kebabBuilding)
    {
        int decisionValue = hunger - 50; // Since 50 should be the average
        decisionValue += kebabBuilding.Reputation;
        decisionValue -= kebabBuilding.customersInQueue.Count;
        decisionValue += Utils.RandomInt(-10, 10);

        bool decision = decisionValue >= 0;
        if (decision)
        {
            state = CustomerState.Queued;
            kebabBuilding.customersInQueue.Add(this);
            timeWhenLeavesQueue = Time.time + decisionValue;
        }

        //Debug.Log(string.Format("Decision value {0}, hunger {1}, building rep {2}, queue {3}", decisionValue, hunger, kebabBuilding.Reputation, kebabBuilding.customersInQueue.Count));
        return decision;
    }
Example #44
0
        //The Brains of the Customer. The Ugliness is Densest Here.
        public bool ProcessSelf()
        {
            switch (state)
            {
                case CustomerState.Shopping:
                    //Wait for Finding Item
                    System.Threading.Thread.Sleep(Store.Get().StoreParams.TimeToBrowsePerItem);

                    //Find Random Item on the List and put in in the cart!
                    lock (this)
                    {
                        Item found = itemList[Store.rand.Next(0, itemList.Count)];
                        itemList.RemoveAt(Store.rand.Next(0, itemList.Count));
                        shoppingCart.Add(found);
                    }
                    if (itemList.Count == 0) // No More items on our List so go to queue
                    {
                        //MainQueue State change
                        state = CustomerState.MainQueue;
                        Queue<Customer> l = Store.Get().MainQueue;
                        lock (l)
                        {
                            l.Enqueue(this);
                            Program.Debug("Customer #" + ID + " -> Main Queue in Pos " + l.Count);

                        }

                    }
                    break;
                case CustomerState.MainQueue:
                    //Just wait until we are at the front of the Main Queue
                    if (Store.Get().MainQueue.Peek() == this)
                    {
                        //We are first now Change States
                        state = CustomerState.FrontOfMainQueue;
                        // -- Start observing the Service Points
                        Store.Get().SPS.RegisterObserver(this);
                        //Check if we can just go
                        OnSPSUpdate();
                    }
                    break;
                case CustomerState.FrontOfMainQueue:
                    // _goToSP will be set in a different thread via OnSPSUpdate()
                    //Check if we have been notified and want to go somewhere
                    if (!upToDate)
                        tryMove();
                    if (_goToSP != null)
                    {
                        if (_goToSP.EnqueueCustomer(this)) //Another customer might have ninja'd it
                        {
                            //Change to SP Queue
                            lock (Store.Get().MainQueue)
                            {
                                Store.Get().MainQueue.Dequeue();
                                Store.Get().SPS.UnregisterObserver(this);
                            }
                            state = CustomerState.ServicePointQueue;
                        }
                        _goToSP = null;
                    }
                    System.Threading.Thread.Sleep(Store.Get().StoreParams.ReactionTimeCustomer);
                    break;

                case CustomerState.ServicePointQueue:
                    //Waiting in Line... Waiting in Line... Items Scanning... ladedaa.
                    //This will be broken by the ServicePoint Telling us to get out of the line
                    System.Threading.Thread.Sleep(Store.Get().StoreParams.ReactionTimeCustomer);
                    break;

                case CustomerState.Exiting:
                    //Bye Bye Store
                    Program.Debug("Customer #" + ID + " -> Finished Paying");
                    System.Threading.Thread.Sleep(Store.Get().StoreParams.TimeToExitStore);
                    lock (Store.Get().CustomerPool)
                    {
                        Store.Get().CustomerPool.Remove(this);
                    }
                    Program.Debug("Customer #" + ID + " -> Exited Store");
                    Program.Debug("customer in store count = " + Store.Get().CustomerPool.Count);
                    return false;
             }
            return true;
        }
Example #45
0
 private void GoToKebabBuilding(KebabBuilding kebabBuilding)
 {
     destinationX = kebabBuilding.tile.x;
     destinationZ = kebabBuilding.tile.z;
     state = CustomerState.MovingToKebabBuilding;
     FindPath();
 }
Example #46
0
 public void PlaceOrder()
 {
     this.State = CustomerState.Waiting;
     this.Order.Place();
 }
Example #47
0
 //Service Point calls this to kick us out of line because were done paying
 public void LetExit()
 {
     lock (this)
     {
         state = CustomerState.Exiting;
     }
 }
Example #48
0
 private void GoToMapEnd()
 {
     Tile destinationTile = world.RoadTiles.Where(t => t.isWorldEdge).OrderBy(t => MathUtils.Distance(t.x, t.z, x, z)).First();
     destinationX = destinationTile.x;
     destinationZ = destinationTile.z;
     state = CustomerState.MovingToMapEnd;
     destinationBuilding = null;
     FindPath();
 }
Example #49
0
 public void enterShop(Shop shop)
 {
     this.Shop = shop;
     this.Order = new Order(this, this.Shop);
     this.State = CustomerState.Shopping;
 }
Example #50
0
 private void GoToOrigin()
 {
     destinationX = originX;
     destinationZ = originZ;
     state = CustomerState.MovingToOrigin;
     destinationBuilding = null;
     FindPath();
 }