// Start is called before the first frame update void Start() { payScreenScript = GetComponentInParent <PayScreen>(); //payScreenCanvas = gameObject.GetComponent<Canvas>(); player = GameObject.FindWithTag("Player"); playerHand = GameObject.FindWithTag("PlayerGrabLocation").transform; playerMoneyTextBox = GameObject.FindWithTag("PlayerMoneyText"); playerMoneyCheckoutTextBox = GameObject.FindWithTag("PlayerMoneyCheckoutText"); totalMoneyTextBox = GameObject.FindWithTag("TotalMoneyText"); totalMoneyCheckoutTextBox = GameObject.FindWithTag("TotalMoneyCheckoutText"); currentOfferTextBox = GameObject.FindWithTag("CurrentOfferText"); currentOfferCheckoutTextBox = GameObject.FindWithTag("CurrentOfferCheckoutText"); notificationTextBox = GameObject.FindWithTag("NotificationText"); product1CountTextBox = GameObject.FindWithTag("Product1CountText"); money = GameObject.FindWithTag("Money"); allMoney = GameObject.FindGameObjectsWithTag("Money"); changeCalculator = new ChangeCalculator(); }
void OnTriggerExit(Collider collidedProduct) { if (!scannable) { return; } if (collidedProduct.gameObject.tag == "Product") { if (collidedProduct.GetComponent <ProductData>().hasBeenScanned == false) { payScreen = GetComponentInParent <PayScreen>(); payScreen.mainText.text = String.Empty; scanningProduct = true; collidedProduct.GetComponent <ProductData>().hasBeenScanned = true; productData = collidedProduct.GetComponent <ProductData>(); productCost = productData.price; productName = collidedProduct.name.Replace("(Clone)", " "); itemizedText.Append($"{productName} {productCost.ToString("c")} \n"); payScreen.itemizedText.text = itemizedText.ToString(); newTotal = total + Convert.ToDecimal(productCost); outputTotalText.Clear(); outputTotalText.Append(newTotal.ToString("c")); payScreen.outputTotalText.text = outputTotalText.ToString(); SoundManager.Instance.PlayOneShot(SoundManager.Instance.scanObjectBeep); scannable = false; scanTimer = 0; total += Convert.ToDecimal(productCost); numItemsScanned = numItemsScanned + 1; } //if(collidedProduct == difficultyChooseVR.GetComponent<DifficultyChooseVR>().currentProduct && shoppingListText != null && shoppingListTextObject != null) //{ // listText.Remove(currentProduct.name.Length, currentProduct.name.Length); // shoppingListText.text = listText.ToString(); //} } }
//ScannerColliderScriptVR scanScript; private void Awake() { payScreenScript = GetComponentInParent <PayScreen>(); audioSource1 = gameObject.GetComponent <AudioSource>(); audioSourceOther = payScreenScript.audioSource2; }