private void OnDrawDebugStuff()
{
if (networkView.isMine && Camera.current != null)
{
GUI.skin = Relay.Instance.BaseSkin;
GUIStyle boxStyle = new GUIStyle(Relay.Instance.BaseSkin.box) {fixedWidth = 0};
foreach (var playerScript in PlayerScript.UnsafeAllEnabledPlayerScripts)
{
if (playerScript == null) continue;
Vector3 newScreenPosition = Camera.current.WorldToScreenPoint(InfoPointForPlayerScript(playerScript));
if (newScreenPosition.z < 0) continue;
Vector2 screenPosition;
if (!LastGUIDebugPositions.TryGetValue(playerScript, out screenPosition))
{
screenPosition = newScreenPosition;
}
// Good stuff, great going guys
screenPosition.y = Screen.height - screenPosition.y;
var rect = new Rect(screenPosition.x - 50, screenPosition.y, 125, 45);
var healthComponent = playerScript.GetComponent<HealthScript>();
if (healthComponent == null)
{
GUI.Box(rect, "No health component");
}
else
{
GUI.Box(rect, "H: " + healthComponent.Health + " S: " + healthComponent.Shield, boxStyle);
}
}
}
}