// 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(); } }
/// <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(""); }