public void StartInspectingShelf(DisplayShelf shelf) { if (!CheckShelvesList(shelf)) { StopCoroutine("InspectShelf"); StartCoroutine(InspectShelf(shelf)); } }
public bool CheckShelvesList(DisplayShelf toCheck) { foreach (DisplayShelf shelf in checkedShelves) { if (shelf == toCheck) { return(true); } } return(false); }
public string GetObjectDescription(StoreObject obj) { DisplayShelf possibleDisplayShelf = obj.GetComponent <DisplayShelf>(); if (possibleDisplayShelf != null) { return("Shelf used to hold products"); } BudtenderCounter possibleBudtenderCounter = obj.GetComponent <BudtenderCounter>(); if (possibleBudtenderCounter != null) { return("Opens " + possibleBudtenderCounter.stations.Count + " budtender jobs. Budtenders assist customers and keep your shelves stocked"); } CheckoutCounter possibleCheckoutCounter = obj.GetComponent <CheckoutCounter>(); if (possibleCheckoutCounter != null) { return("Place for customers to check out"); } return("Error: " + obj.ToString()); }
IEnumerator InspectShelf(DisplayShelf shelf) { /* checkedShelves.Add(shelf); * List<ProductPosition> shelfPositions = shelf.positions; * bool inspectingProduct = false; * int inspectTimer = 0; * int desiredProductMaxTime = 350; * int regularMaxTime = UnityEngine.Random.Range(60, 250); * Product product = null; * bool productDesired = false; // If the product is highly desired. Causes customer to look at it longer * bool regularDesired = false; // If the product is just regular, look at it a short while * while (currentIndex < shelfPositions.Count) * { * if (!checkedIndex && !inspectingProduct) * { * checkedIndex = true; * ProductPosition thisPos = shelfPositions[currentIndex]; * if (thisPos != null) * { * Product thisProduct = thisPos.product; * if (thisProduct != null) * { * product = thisProduct; * inspectingProduct = true; * float interest = GenerateInterest(product); * print(product.GetName() + " " + interest); * pathfinding.GeneratePathToPosition(thisPos.transform.position, RaiseIndex); * } * pathfinding.GeneratePathToPosition(thisPos.transform.position); * } * } * else if (!checkedIndex && inspectingProduct) * { * if (product != null) * { * if (productDesired) * { * if (inspectTimer >= desiredProductMaxTime) * { * inspectingProduct = false; * inspectTimer = 0; * } * } * else * { * if (inspectTimer > regularMaxTime) * { * regularMaxTime = UnityEngine.Random.Range(60, 250); * inspectingProduct = false; * inspectTimer = 0; * } * } * } * inspectTimer++; * } * else * { * inspectTimer++; * if (inspectTimer > regularMaxTime) // Timeout * { * RaiseIndex(); * inspectingProduct = false; * inspectTimer = 0; * } * } * yield return null; * } */ pathfinding.FinishSequentialAction(); yield return(null); }
public InspectShelf(DisplayShelf shelf_) : base(ActionType.sequence) { shelf = shelf_; SetupDictionary(); }