using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class PlayerNames : MonoBehaviour {
	GameObject activatedPlayer1;
	GameObject activatedPlayer2;

	bool state = false;
	
	// Update is called once per frame
	void Update () {
		if(this.gameObject.name == "player1"){
			this.transform.GetComponent<Text>().text = GameMaster.players[0].GetName();
			activatedPlayer1 = this.gameObject.transform.parent.GetChild(8).gameObject;
			activatedPlayer1.SetActive(GameMaster.state);
		}

		if(this.gameObject.name == "player2"){
			this.transform.GetComponent<Text>().text = GameMaster.players[1].GetName();
			activatedPlayer2 = this.gameObject.transform.parent.GetChild(8).gameObject;
			activatedPlayer2.SetActive(!GameMaster.state);
		}
	}
}
