using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class SpectatorMarkers : MonoBehaviour {
	/*
	public List<PlayerMarker> playerMarkers;
	public GameObject spectatorMap;
	public GameObject fakeMarker;
	SpectatorController controller;


	// Use this for initialization
	void Awake () {
		controller = GameObject.FindObjectOfType<SpectatorController> ();
		if (controller) {
			fakeMarker.GetComponent<SpriteRenderer> ().enabled = false;
		}
	}
	
	// Update is called once per frame
	void Update () {
		if (controller) {
			if (controller.IsCurrentlySpectatingPlayer ()) {
				fakeMarker.SetActive (false);
				AssignAndDisplayMarkers ();
			}
		}

		if (Input.GetKeyDown (KeyCode.M) && SceneManager.GetActiveScene().name != "Launcher" && SceneManager.GetActiveScene().name != "Esports Launcher") {
			spectatorMap.SetActive (!spectatorMap.activeInHierarchy);
		}
	}

	void AssignAndDisplayMarkers () {
		GameObject[] markers = GameObject.FindGameObjectsWithTag ("Player Marker");
		if (markers == null)
			return;

		for (int i = 0; i < markers.Length; i++) {
			if (!playerMarkers [i].isAssigned) {
				markers [i].GetComponent<SpriteRenderer> ().color = playerMarkers [i].markerColor;
				playerMarkers [i].isAssigned = true;
				markers [i].GetComponent<SpriteRenderer> ().enabled = true;
			}
		}
	}
*/

}

[System.Serializable]
public class PlayerMarker {
	public Color markerColor;
	public bool isAssigned = false;
}
