예제 #1
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();
        EditorGUI.BeginDisabledGroup(script.gridMap == null);
        placeOnAwake.boolValue = EditorGUILayout.Toggle("Place On Awake", placeOnAwake.boolValue);
        EditorGUI.EndDisabledGroup();
        script.moveOnPlace = EditorGUILayout.Toggle("Move On Place", script.moveOnPlace);
        prefabList.DoLayoutList();
        script.basePosition = EditorGUILayout.Vector3Field("Base Position", script.basePosition);

        EditorGUILayout.Space();
        if (GUILayout.Button("Calculate Base"))
        {
            Undo.RecordObject(script, "calculateBase");
            script.CalculateBase();
        }
        EditorGUI.BeginDisabledGroup(script.gridMap == null);
        if (GUILayout.Button("Simulate Place In Grid"))
        {
            Undo.RecordObject(script, "placeInGrid");
            if (script.gridMap)
            {
                script.PlaceObjectInGrid(script.gridMap, false, true);
            }
            else
            {
                Debug.Log("You need to indicate the GridMap first", script);
            }
        }
        EditorGUI.EndDisabledGroup();
        serializedObject.ApplyModifiedProperties();
    }