2024-03-05 17:34:41 +08:00
#if GRIFFIN
2023-12-30 17:37:48 +08:00
using UnityEditor ;
using UnityEngine ;
namespace Pinwheel.Griffin
{
[CustomEditor(typeof(GNavigationHelper))]
public class GNavigationHelperInspector : Editor
{
private GNavigationHelper instance ;
public void OnEnable ( )
{
instance = target as GNavigationHelper ;
}
public override void OnInspectorGUI ( )
{
instance . GroupId = GEditorCommon . ActiveTerrainGroupPopupWithAllOption ( "Group Id" , instance . GroupId ) ;
DrawInstructionGUI ( ) ;
DrawActionGUI ( ) ;
}
public override bool RequiresConstantRepaint ( )
{
return false ;
}
private void DrawInstructionGUI ( )
{
string label = "Instruction" ;
string id = "instruction" + instance . GetInstanceID ( ) . ToString ( ) ;
GEditorCommon . Foldout ( label , true , id , ( ) = >
{
EditorGUILayout . LabelField ( "Create dummy game objects for Nav Mesh baking. These game objects should be removed in production." , GEditorCommon . WordWrapItalicLabel ) ;
} ) ;
}
private void DrawActionGUI ( )
{
string label = "Actions" ;
string id = "actions" + instance . GetInstanceID ( ) . ToString ( ) ;
GEditorCommon . Foldout ( label , true , id , ( ) = >
{
Rect createButtonRect = EditorGUILayout . GetControlRect ( ) ;
if ( GUI . Button ( createButtonRect , "Create static obstacles" ) )
{
instance . CreateStaticObstacles ( ) ;
}
Rect deleteButtonRect = EditorGUILayout . GetControlRect ( ) ;
if ( GUI . Button ( deleteButtonRect , "Delete static obstacles" ) )
{
instance . DeleteStaticObstacles ( ) ;
}
} ) ;
}
}
}
2024-03-05 17:34:41 +08:00
#endif