Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class PointsColliderFinal : MonoBehaviour
- {
- private Text DisplayPoints;
- private void Start()
- {
- DisplayPoints = GameObject.Find("Text").GetComponent<Text>();
- }
- private void OnTriggerEnter(Collider other)
- {
- if(other.tag == "One")
- {
- int Points = int.Parse(DisplayPoints.text); //converts text to integer
- DisplayPoints.text = (Points + 1).ToString();
- }
- if (other.tag == "Two")
- {
- int Points = int.Parse(DisplayPoints.text); //converts text to integer
- DisplayPoints.text = (Points + 2).ToString();
- }
- if (other.tag == "Three")
- {
- int Points = int.Parse(DisplayPoints.text); //converts text to integer
- DisplayPoints.text = (Points + 3).ToString();
- }
- if (other.tag == "Four")
- {
- int Points = int.Parse(DisplayPoints.text); //converts text to integer
- DisplayPoints.text = (Points + 4).ToString();
- }
- if (other.tag == "Five")
- {
- int Points = int.Parse(DisplayPoints.text); //converts text to integer
- DisplayPoints.text = (Points + 5).ToString();
- }
- if (other.tag == "Six")
- {
- int Points = int.Parse(DisplayPoints.text); //converts text to integer
- DisplayPoints.text = (Points + 6).ToString();
- }
- if (other.tag == "Seven")
- {
- int Points = int.Parse(DisplayPoints.text); //converts text to integer
- DisplayPoints.text = (Points + 7).ToString();
- }
- if (other.tag == "Eight")
- {
- int Points = int.Parse(DisplayPoints.text); //converts text to integer
- DisplayPoints.text = (Points + 8).ToString();
- }
- if (other.tag == "Nine")
- {
- int Points = int.Parse(DisplayPoints.text); //converts text to integer
- DisplayPoints.text = (Points + 9).ToString();
- }
- if (other.tag == "Ten")
- {
- int Points = int.Parse(DisplayPoints.text); //converts text to integer
- DisplayPoints.text = (Points + 10).ToString();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement