/************************************************
/* isoCamGUI.cs by Deozaan
/*
/* This script displays a GUI on screen which allows the user to play with
/* the options of my isometric camera control script in real-time.
/************************************************/

using UnityEngine;
using System.Collections;

public class isoCamGUI : MonoBehaviour {

	public isometricCameraControl isoCam; // requires isoCameraControl.cs
	public bool enableGUI = true; // disable this to hide the options GUI

	private bool hideOptions = true;

	// use this for earlier initialization
	void Awake() {
		if (!isoCam) {
			Debug.LogError("ERROR: Can't display GUI. Don't forget to set isoCam to the object which has isoCameraControl attached to it in the Inspector.");
		}
	}

	void OnGUI() {
		if (isoCam && enableGUI) {
			// GUILayout.Box(
			GUILayout.BeginArea(new Rect(10, 10, 150, 300));

			if (hideOptions) {
				hideOptions = GUILayout.Toggle(hideOptions, "Show Options", "button");
			} else {
				hideOptions = GUILayout.Toggle(hideOptions, "Hide Options", "button");

				// rotation GUI stuff
				GUILayout.Label("Rotation Settings");
				//isoCam.GetComponent(isoCameraControl).offsetRotationBy45 = GUILayout.Toggle(isoCam.offsetRotationBy45, "Offset initial rotation by 45 degrees?");
				isoCam.invertRotation = GUILayout.Toggle(isoCam.invertRotation, new GUIContent("Invert Rotation", "If enabled, left is right and right is left."));
				//isoCam.GetComponent(isoCameraControl).invertRotation = GUILayout.Toggle(isoCam.invertRotation, GUIContent("Invert Rotation", "Left is right and right is left."), "button");
				isoCam.rotateInstantly = GUILayout.Toggle(isoCam.rotateInstantly, new GUIContent("Rotate Instantly", "If enabled, rotation happens instantly."));
				GUILayout.Box(new GUIContent("Rotation Damping: " + Mathf.Round(isoCam.rotationDamping), "How fast the camera rotates. Higher is faster."));
				isoCam.rotationDamping = GUILayout.HorizontalSlider(isoCam.rotationDamping, 0f, 10f);
				isoCam.rotateBy45 = GUILayout.Toggle(isoCam.rotateBy45, new GUIContent("Rotate by 45", "If enabled, rotation occurs in 45 degree increments. Otherwise rotation occurs in the default of 90."));

				// zoom GUI stuff
				GUILayout.Label("");
				GUILayout.Label("Zoom Settings");
				isoCam.invertZoom = GUILayout.Toggle(isoCam.invertZoom, new GUIContent("Invert Zoom", "If enabled, in is out and out is in."));
				isoCam.zoomInstantly = GUILayout.Toggle(isoCam.zoomInstantly, new GUIContent("Zoom Instantly", "If enabled, zooming happens instantly."));
				GUILayout.Box(new GUIContent("Zoom Damping: " + Mathf.Round(isoCam.zoomDamping), "How fast the camera zooms. Higher is faster."));
				isoCam.zoomDamping = GUILayout.HorizontalSlider(isoCam.zoomDamping, 0f, 10f);

				/*
				// position GUI stuff
				GUILayout.Label("");
				GUILayout.Label("Positional Settings");
				isoCam.GetComponent(isoCameraControl).instantPosition = GUILayout.Toggle(isoCam.instantPosition, GUIContent("Instant Position", "Currently has no effect unless camera changes focus target."));	
				*/
			}

			GUILayout.EndArea();
			// tooltips
			GUI.Label(new Rect(10, Screen.height - 30, Screen.width - 10, 25), GUI.tooltip);
		}
	}
}
