Advertisement
Guest User

Untitled

a guest
Oct 20th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.64 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3. using UnityEngine.UI;
  4.  
  5. public class ScoringSystem : MonoBehaviour {
  6.     public Text scoreTextRight;
  7.     public Text scoreTextLeft;
  8.     public string scorePlayerLeft;
  9.     public string scorePlayerRight;
  10.     void Start () {
  11.  
  12.     }
  13.  
  14.     void OnCollisionEnter2D(Collision2D col)
  15.     {
  16.         if (col.gameObject.name == "WallLeft") {
  17.             scoreTextLeft.text = scorePlayerLeft;
  18.             scorePlayerLeft += 1;
  19.             scoreTextLeft.text = scorePlayerLeft;
  20.  
  21.         } else if (col.gameObject.name == "WallRight") {
  22.             scoreTextRight.text = scorePlayerRight;
  23.             scorePlayerRight += 1;
  24.             scoreTextRight.text = scorePlayerRight;
  25.  
  26.         }
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement