// Start is called before the first frame update void Start() { GetNamePanel = GameObject.Find("Canvas/GetNamePanel"); GetNamePanelColor = GetNamePanel.GetComponent <Image>(); openAnim = GameObject.Find("OpenAnim"); openRender = openAnim.GetComponent <SpriteRenderer>(); camera = GameObject.Find("UICameraForBook").GetComponent <Camera>(); soundEffectsInBegin = GameObject.FindWithTag("GameController").GetComponent <SoundEffectsInBegin>(); AudioSource = GameObject.FindWithTag("GameController").GetComponent <AudioSource>(); hintText = GameObject.Find("HintText"); }
// Use this for initialization void Start() { Canvas[] c = GetComponentsInParent <Canvas>(); if (c.Length > 0) { canvas = c[c.Length - 1]; } else { Debug.LogError("Book Must be a child to canvas diectly or indirectly"); } UpdatePages(); CalcCurlCriticalPoints(); float pageWidth = BookPanel.rect.width / 2.0f; float pageHeight = BookPanel.rect.height; ClippingPlane.rectTransform.sizeDelta = new Vector2(pageWidth * 2 + pageHeight, pageHeight + pageHeight * 2); //hypotenous (diagonal) page length float hyp = Mathf.Sqrt(pageWidth * pageWidth + pageHeight * pageHeight); float shadowPageHeight = pageWidth / 2 + hyp; Shadow.rectTransform.sizeDelta = new Vector2(pageWidth, shadowPageHeight); Shadow.rectTransform.pivot = new Vector2(1, (pageWidth / 2) / shadowPageHeight); ShadowLTR.rectTransform.sizeDelta = new Vector2(pageWidth, shadowPageHeight); ShadowLTR.rectTransform.pivot = new Vector2(0, (pageWidth / 2) / shadowPageHeight); RightPageShadow.rectTransform.sizeDelta = new Vector2(pageWidth, shadowPageHeight); RightPageShadow.rectTransform.pivot = new Vector2(0, (pageWidth / 2) / shadowPageHeight); LeftPageShadow.rectTransform.sizeDelta = new Vector2(pageWidth, shadowPageHeight); LeftPageShadow.rectTransform.pivot = new Vector2(1, (pageWidth / 2) / shadowPageHeight); soundEffectsInBegin = GameObject.FindWithTag("GameController").GetComponent <SoundEffectsInBegin>(); AudioSource = GameObject.FindWithTag("GameController").GetComponent <AudioSource>(); }
// Start is called before the first frame update void Start() { if (SceneManager.GetActiveScene().name == "UIScene") { bookPro = GameObject.Find("Canvas/ChooseLevelPanel/BookPro").GetComponent <BookPro>(); soundEffectsInBegin = GameObject.FindWithTag("GameController").GetComponent <SoundEffectsInBegin>(); AudioSource = GameObject.FindWithTag("GameController").GetComponent <AudioSource>(); text1 = GameObject.Find("HintText2").GetComponent <Text>(); text2 = GameObject.Find("HintText3").GetComponent <Text>(); button = GameObject.Find("Exit"); } if (SceneManager.GetActiveScene().name == "StoryMode") { alert = GameObject.Find("Alert").GetComponent <Text>(); alert.DOFade(1, 0.1f); StartCoroutine(AlertShow()); } }