SHARE
TWEET

Untitled

a guest Jul 21st, 2019 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class PointsColliderFinal : MonoBehaviour
  2. {
  3.     private Text DisplayPoints;
  4.  
  5.     private void Start()
  6.     {
  7.         DisplayPoints = GameObject.Find("Text").GetComponent<Text>();
  8.     }
  9.  
  10.     private void OnTriggerEnter(Collider other)
  11.     {
  12.        
  13.         if(other.tag == "One")
  14.         {
  15.             int Points = int.Parse(DisplayPoints.text); //converts text to integer
  16.  
  17.             DisplayPoints.text = (Points + 1).ToString();
  18.         }
  19.         if (other.tag == "Two")
  20.         {
  21.             int Points = int.Parse(DisplayPoints.text); //converts text to integer
  22.  
  23.             DisplayPoints.text = (Points + 2).ToString();
  24.  
  25.         }
  26.         if (other.tag == "Three")
  27.         {
  28.             int Points = int.Parse(DisplayPoints.text); //converts text to integer
  29.  
  30.             DisplayPoints.text = (Points + 3).ToString();
  31.  
  32.         }
  33.         if (other.tag == "Four")
  34.         {
  35.             int Points = int.Parse(DisplayPoints.text); //converts text to integer
  36.  
  37.             DisplayPoints.text = (Points + 4).ToString();
  38.         }
  39.         if (other.tag == "Five")
  40.         {
  41.             int Points = int.Parse(DisplayPoints.text); //converts text to integer
  42.  
  43.             DisplayPoints.text = (Points + 5).ToString();
  44.         }
  45.         if (other.tag == "Six")
  46.         {
  47.             int Points = int.Parse(DisplayPoints.text); //converts text to integer
  48.  
  49.             DisplayPoints.text = (Points + 6).ToString();
  50.         }
  51.         if (other.tag == "Seven")
  52.         {
  53.             int Points = int.Parse(DisplayPoints.text); //converts text to integer
  54.  
  55.             DisplayPoints.text = (Points + 7).ToString();
  56.         }
  57.         if (other.tag == "Eight")
  58.         {
  59.             int Points = int.Parse(DisplayPoints.text); //converts text to integer
  60.  
  61.             DisplayPoints.text = (Points + 8).ToString();
  62.         }
  63.         if (other.tag == "Nine")
  64.         {
  65.             int Points = int.Parse(DisplayPoints.text); //converts text to integer
  66.  
  67.             DisplayPoints.text = (Points + 9).ToString();
  68.         }
  69.         if (other.tag == "Ten")
  70.         {
  71.             int Points = int.Parse(DisplayPoints.text); //converts text to integer
  72.  
  73.             DisplayPoints.text = (Points + 10).ToString();
  74.         }
  75.     }
  76.  
  77. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top