//Initialization public void WakeUp() { //Set up references tweetText = new GameObject("Tweet text"); tweetText.transform.parent = transform; //Add this text object to a list held by the main camera so we can enable/disable text Camera.main.GetComponent<cameraOrbitControls>().textMeshObjects.Add(tweetText.AddComponent<TextMesh>()); numbersToSliders nums = GameObject.Find("numbersToSliders").GetComponent<numbersToSliders>(); IslandInfoUI = GameObject.Find("IslandInfo UI").GetComponent<MenuMover>(); //Create a text mesh object to float above the island, displaying the tweet meshy = tweetText.GetComponent<TextMesh>(); meshy.anchor = TextAnchor.LowerCenter; meshy.alignment = TextAlignment.Center; //Place the text mesh above the flagpole, the highest point on the island, in the middle meshy.transform.position = GameObject.Find("flagpole " + islandIndex).transform.position + new Vector3(0,1,0); meshy.fontSize = 50; //Scale the character size of the text mesh based on number of re-tweets meshy.characterSize = Mathf.Clamp(nums.findRank(thisTweet.retweet_count,false) / 20,0.25f,1); //Format the tweet text appropriately for display FormatString(thisTweet.text, meshy); //Find the height and size rank for the associated tweet sizeRank = nums.findRank(thisTweet.retweet_count, false); heightRank =nums.findRank(thisTweet.favorite_count,true); }
private void Awake() { menuMover = GetComponent <MenuMover>(); menus = GetComponentsInChildren <BaseMenu>(); }