void MoveRight() { var p = template.GetChildren(activeObject.transform).ToArray(); if (p.Length > 0) { Selection.activeGameObject = p[HittUtility.Clamp(p, activeEntrance)].gameObject; } }
void EntranceGUI() { var ev = Event.current; var ms = ev.mousePosition; GateTags e = null; EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); EditorGUI.BeginChangeCheck(); if (template.gates.Length > 0) { e = template.gates[HittUtility.Clamp(template.gates, activeEntrance)]; e.name = EditorGUILayout.TextField(e.name); e.color = EditorGUILayout.ColorField(e.color); e.size = EditorGUILayout.Vector3Field(GUIContent.none, e.size); } if (GUILayout.Button("+", GUILayout.Width(50))) { Undo.RecordObject(template, "Add new Entrance Template"); ArrayUtility.Add(ref template.gates, e == null ? new GateTags() : e.Clone()); } if (GUILayout.Button("-", GUILayout.Width(50)) && template.gates.Length > 1) { Undo.RecordObject(template, "Delete Entrance Template"); ArrayUtility.RemoveAt(ref template.gates, activeEntrance); activeEntrance--; } if (EditorGUI.EndChangeCheck()) { SceneView.RepaintAll(); } EditorGUILayout.EndHorizontal(); Styles.MakeGrid(new Vector2(150, 50), template.gates.Length, delegate(Rect r, int i) { var g = template.gates[i]; var c = GUI.color; if (ev.type == EventType.Repaint) { GUI.color = g.color; GUI.Box(r, Texture2D.whiteTexture); GUI.color = c; GUI.Label(r, g.name, Styles.labelStyles[(Styles.IsDark(g.color) ? 1 : 0) + (activeEntrance == i ? 2 : 0)]); } if (ev.type == EventType.MouseDown && r.Contains(ms)) { activeEntrance = i; if (active != null) { DragAndDrop.PrepareStartDrag(); DragAndDrop.objectReferences = new UnityEngine.Object[] { template }; DragAndDrop.SetGenericData("MittEntrance", g); DragAndDrop.visualMode = DragAndDropVisualMode.Copy; DragAndDrop.StartDrag("Make Prefab"); } else { Repaint(); } } }); }