GUIManager.cs 1.55 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
using UnityEngine;
using System.Text;

public class GUIManager : MonoBehaviour {
	
	private static GUIManager instance;
	public MapManager mapManager;
	public NpcManager npcManager;
	public CameraControlScript mainCamera;

	void Start () {
		instance = this;
	}
	
	void Update () {
		if (Input.GetKeyDown (KeyCode.Z)) {
			mapManager.CycleZ(false);
		}
		if (Input.GetKeyDown (KeyCode.A)) {
			mapManager.CycleZ(true);
		}
		if (Input.GetKeyDown (KeyCode.Space)) {
			mainCamera.ReturnToHome();
		}
		if (Input.GetKeyDown (KeyCode.N)) {
26
			CellLoc randomNpcCell = npcManager.locateRandomNpc();
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
            Vector3 randomNpcPos = CLUtils.CellLocToVector3(randomNpcCell, 1);
			mainCamera.lookAtNpc(randomNpcPos);
			mapManager.UpdateZ(randomNpcCell.z);
		}
	}
			
	void OnGUI(){
		GUI.Box (new Rect (0,0,100,50), "# of cells\n" + mapManager.num_cells);
		GUI.Box (new Rect (100,0,100,50), "NPC Instances\n" + npcManager.NumNpcScripts);
		GUI.Box (new Rect (200,0,100,50), "Active NPC Insts\n" + npcManager.NumActiveNpcScripts);
		GUI.Box (new Rect (300,0,100,50), "NPCs in DB\n" + npcManager.NumNpcsInDb);
		GUI.Box (new Rect (Screen.width - 100,0,100,50), "# of blocks\n" + mapManager.num_blocks);
		GUI.Box (new Rect (0,Screen.height - 50,100,50), "Z top\n" + mapManager.zTop);
		StringBuilder builder = new StringBuilder();
		foreach (int gameRound in npcManager.activeGameRounds)
			builder.Append(gameRound).Append(" ");
		GUI.Box (new Rect (Screen.width - 100,Screen.height - 50,100,50), "Game Round\n" + builder.ToString());
	}
	
}