Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class InfoText : MonoBehaviour {
- private GameObject Text;
- public int timeActive;
- public string TextContent;
- void Start()
- {
- Text = GameObject.Find ("InfoText");
- Text.GetComponent<Text>().text = TextContent;
- Text.SetActive (false);
- }
- void OnTriggerEnter(Collider other)
- {
- if (other.transform.name == "cowboy_game_player")
- {
- Text.SetActive (true);
- }
- }
- void OnTriggerStay(Collider other)
- {
- if (other.transform.name == "cowboy_game_player")
- {
- Text.SetActive (true);
- }
- }
- void OnTriggerExit(Collider other)
- {
- if (other.transform.name == "cowboy_game_player")
- {
- Invoke ("manualDeactivate", timeActive);
- }
- }
- void manualDeactivate()
- {
- Text.SetActive (false);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement