public string GetProductInfo(Product product) { switch (product.productType) { case Product.type_.storageJar: StorageJar jar = (StorageJar)product; return("Strain: " + jar.GetStrain().name); case Product.type_.glassBong: case Product.type_.acrylicBong: Bong bong = (Bong)product; return("Height: " + bong.height); case Product.type_.glassPipe: case Product.type_.acrylicPipe: Pipe pipe = (Pipe)product; return("Length: " + pipe.length); case Product.type_.rollingPaper: RollingPaper paper = (RollingPaper)product; return(paper.paperType.ToString()); case Product.type_.edible: Edible edible = (Edible)product; return(edible.edibleType.ToString()); case Product.type_.box: StorageBox box = (StorageBox)product; return("Products: " + box.products.Count); } return("ProductType"); }
public float GenerateInterest(Product product) { float interestValue = 50; if (desiredProducts.Count > 0) { foreach (Product desiredProduct in desiredProducts) { if (product.productType == desiredProduct.referenceType) { interestValue += 20; switch (product.productType) { case Product.type_.glassPipe: case Product.type_.acrylicPipe: Pipe pipe = (Pipe)product; DesiredGlass glassPipe = (DesiredGlass)desiredProduct; float inspectingLength = pipe.length; float desiredLength = glassPipe.height; float lengthDifference = Mathf.Abs(inspectingLength - desiredLength); int pipeInterest = (int)MapValue(0, 25, 30, 0, lengthDifference); // Take a difference of 0-25 and convert it respectively to a range of 30-0 interestValue += pipeInterest; break; case Product.type_.glassBong: case Product.type_.acrylicBong: Bong bong = (Bong)product; DesiredGlass glassBong = (DesiredGlass)desiredProduct; float inspectingHeight = bong.height; float desiredHeight = glassBong.height; float heightDifference = Mathf.Abs(inspectingHeight - desiredHeight); int bongInterest = (int)MapValue(0, 22, 30, 0, heightDifference); // Take a difference of 0-22 and convert it respectively to a range of 30-0 interestValue += bongInterest; break; case Product.type_.edible: Edible edible = (Edible)product; DesiredEdible desiredEdible = (DesiredEdible)desiredProduct; if (edible.edibleType == desiredEdible.desiredType) { float thcDifference = Mathf.Abs(edible.THCpercent - desiredEdible.desiredTHC); int edibleInterest = (int)MapValue(0, 250, 30, 0, thcDifference); // Take a difference of 0-250 and convert it respectively to a range of 30-0 interestValue += edibleInterest; } break; case Product.type_.rollingPaper: RollingPaper paper = (RollingPaper)product; DesiredPaper desiredPaper = (DesiredPaper)desiredProduct; if (paper.paperType == desiredPaper.desiredType) { interestValue += 30; } break; } } } } if (desiredStrains.Count > 0 && product.GetProductType() == Product.type_.storageJar) { interestValue += 10; StorageJar jar = (StorageJar)product; Strain bestMatch = null; float bestMatchValue = 50; foreach (DesiredStrain strain in desiredStrains) { float matchValue = StrainTypeMatch(strain.strain, jar.GetStrain()); if (matchValue > bestMatchValue) { bestMatch = strain.strain; bestMatchValue = matchValue; } } if (bestMatch != null) { int strainInterest = (int)MapValue(0, 100, 0, 40, bestMatchValue); interestValue += strainInterest; } } print(customerName + ": " + product.GetName() + " " + interestValue); return(interestValue); }
public RollingPaper_s(RollingPaper paper) : base(Product.type_.rollingPaper, paper.uniqueID, paper.objectID, paper.subID, paper.GetName(), paper.productGO.transform.position, paper.productGO.transform.eulerAngles) { paperType = paper.paperType; }
public DesiredPaper() : base(type_.reference, type_.rollingPaper) { desiredType = RollingPaper.GetRandomPaperType(); }