You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
950 B
44 lines
950 B
using UnityEditor; |
|
using UnityEngine; |
|
using System.Collections; |
|
|
|
namespace Fungus |
|
{ |
|
[CustomEditor (typeof(Game))] |
|
public class GameEditor : Editor |
|
{ |
|
private void OnSceneGUI() |
|
{ |
|
GameEditor.DrawRoomNames(); |
|
} |
|
|
|
static public void DrawRoomNames() |
|
{ |
|
Handles.color = Color.white; |
|
Handles.BeginGUI(); |
|
|
|
// Show labels for each room |
|
Room[] rooms = GameObject.FindObjectsOfType<Room>(); |
|
|
|
foreach (Room room in rooms) |
|
{ |
|
if (!room.renderer) |
|
{ |
|
continue; |
|
} |
|
|
|
Bounds bounds = room.renderer.bounds; |
|
Vector3 pos = new Vector3(bounds.min.x, bounds.max.y, 0); |
|
|
|
GUIStyle style = new GUIStyle(GUI.skin.label); |
|
style.normal.textColor = new Color(1,1,1); |
|
style.fontSize /= 2; |
|
Rect boxRect = HandleUtility.WorldPointToSizedRect(pos, new GUIContent(room.name), style); |
|
boxRect.y -= boxRect.height * 1.5f; |
|
GUI.Box(boxRect, room.name, style); |
|
} |
|
|
|
Handles.EndGUI(); |
|
} |
|
} |
|
} |