/*
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon.Pun;
using TMPro;

public class UsernameDisplay : MonoBehaviour {

	public TextMeshProUGUI usernameText;
	public PlayerBase myPlayer;
	SpectatorController checkSpectator;
	float maxDist = 100f, minDist = 20f, maxSize = 24f, minSize = 16f;

	void Start () {
		usernameText.text = "";
		checkSpectator = GameObject.FindObjectOfType<SpectatorController> ();
	}

	void LateUpdate () {
		if (checkSpectator) {
			if (checkSpectator.IsCurrentlySpectatingPlayer ()) {
			Vector3 inPos = Camera.main.WorldToViewportPoint (transform.position);
				if (inPos.z > 0) {
					if (inPos.x < 1 && inPos.x > 0 && inPos.y < 1 && inPos.y > 0) {
						Vector3 usernamePos = Camera.main.WorldToScreenPoint (this.transform.position);
						usernameText.transform.position = usernamePos;
						object val;
						if (myPlayer.photonView.Owner.CustomProperties.TryGetValue ("DisplayName", out val)) {
							usernameText.text = (string)val;
							usernameText.fontSize = CheckDistance ();
							return;
						}
					}
				}
			}
		}
		usernameText.text = "";
	}

	float CheckDistance () {
		float distCheck = Vector3.Distance (transform.position, Camera.main.transform.position);

		if (distCheck > maxDist) {
			return 16f;
		} else if (distCheck < minDist) {
			return 24f;
		} else {
			float m = ((minSize - maxSize) / (maxDist - minDist));
			float b = minSize - m * maxDist;

			float fontSize = m * distCheck + b;
			return fontSize;
		}
	}
}
*/
