View difference between Paste ID: gszbjGQK and wDEfdhnQ
SHOW: | | - or go back to the newest paste.
1
using UnityEngine;
2
using System.Collections;
3
4-
public class EnemyHealth : MonoBehaviour 
4+
public class ScoreController : MonoBehaviour 
5
{
6
	private int score
7-
		public Transform target;
7+
8
	void Awake ()
9-
		void  OnGUI ()
9+
10-
		{ 
10+
		score = 0;
11-
			Vector3 wantedPos = Camera.main.WorldToScreenPoint (target.position); 
11+
	}
12-
			GUI.Label(new Rect(wantedPos.x, wantedPos.y, 100, 20), "Darth Valdemort!");
12+
13-
		}
13+
	void  OnGUI ()
14-
	}
14+
		GUI.Label(10, 10, 100, 20), "Score: " + score);
15
	}
16
17
	public void AddScore (newScoreValue)
18
	{
19
		score += newScoreValue;
20
	}
21
}