Commit 6a9ec918 by Philipp Adolf

Fix null reference in PlayerHealth

parent 7d9c2dd3
......@@ -10,7 +10,6 @@ public class PlayerHealth : MonoBehaviour {
private bool alive = true;
private Scrollbar healthbar;
private PlayerControl playerControl;
private GameStateTracker gameStateTracker;
private bool hasShield = false;
public void init(int playerNumber)
......@@ -31,7 +30,7 @@ public class PlayerHealth : MonoBehaviour {
{
Debug.Log("Player " + name + " dead.");
alive = false;
gameStateTracker.playerDied(name);
((GameStateTracker) Object.FindObjectOfType(typeof(GameStateTracker))).playerDied(name);
Destroy(gameObject);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment