private void UpdatePurchase() { float anchorX = MarketMenu.GetComponent <RectTransform>().anchoredPosition.x; float anchorY = MarketMenu.GetComponent <RectTransform>().anchoredPosition.y; if (marketVisible) { if (MarketMenu.GetComponent <RectTransform>().anchoredPosition.y > -176) { MarketMenu.GetComponent <RectTransform>().anchoredPosition = new Vector3(anchorX, anchorY - 1200 * Time.deltaTime); if (MarketMenu.GetComponent <RectTransform>().anchoredPosition.y < -176) { VendorSpeech.GetComponent <RectTransform>().anchoredPosition = new Vector3(anchorX, -176); } } if (!MarketMenu.activeSelf) { MarketMenu.SetActive(true); } } else { if (MarketMenu.GetComponent <RectTransform>().anchoredPosition.y < 220) { MarketMenu.GetComponent <RectTransform>().anchoredPosition = new Vector3(anchorX, anchorY + 1200 * Time.deltaTime); } if (MarketMenu.activeSelf && MarketMenu.GetComponent <RectTransform>().anchoredPosition.y >= 220) { MarketMenu.GetComponent <RectTransform>().anchoredPosition = new Vector3(anchorX, 220); MarketMenu.SetActive(false); } } }
private void UpdateSpeech() { float anchorX = VendorSpeech.GetComponent <RectTransform>().anchoredPosition.x; float anchorY = VendorSpeech.GetComponent <RectTransform>().anchoredPosition.y; if (speechVisible) { if (VendorSpeech.GetComponent <RectTransform>().anchoredPosition.y < 94) { VendorSpeech.GetComponent <RectTransform>().anchoredPosition = new Vector3(anchorX, anchorY + 1200 * Time.deltaTime); if (VendorSpeech.GetComponent <RectTransform>().anchoredPosition.y >= 94) { VendorSpeech.GetComponent <RectTransform>().anchoredPosition = new Vector3(anchorX, 94); canSpeek = true; } } if (!VendorSpeech.activeSelf) { VendorSpeech.SetActive(true); } } else { canSpeek = false; if (VendorSpeech.GetComponent <RectTransform>().anchoredPosition.y > -94) { VendorSpeech.GetComponent <RectTransform>().anchoredPosition = new Vector3(anchorX, anchorY - 1200 * Time.deltaTime); } if (VendorSpeech.activeSelf && VendorSpeech.GetComponent <RectTransform>().anchoredPosition.y <= -94) { VendorSpeech.GetComponent <RectTransform>().anchoredPosition = new Vector3(anchorX, -94); VendorSpeech.SetActive(false); } } if (speechVisible && vendorSpeechText.text != currentVendorText && canSpeek) { vendorSpeechTimer += Time.deltaTime; vendorSoundTimer += Time.deltaTime; if (vendorSpeechTimer > 0.04f) { if (vendorSpeechText.text.Length < currentVendorText.Length) { vendorSpeechText.text += currentVendorText[vendorSpeechText.text.Length]; vendorSpeechTimer = 0f; } } if (vendorSoundTimer > 0.15f) { FindObjectOfType <AudioManager>().Play("talk" + Random.Range(1, 4)); vendorSoundTimer = 0f; } } }