예제 #1
0
        void SetSpatialConstraintEditorAsset(SpatialConstraintAsset spatialAsset, SpatialConstraintsEditorAssignmentState state)
        {
            if (spatailWindowState.initialized &&
                spatailWindowState.spatialAsset == spatialAsset &&
                spatailWindowState.assignmentState == state)
            {
                // The states are the same. no need to assign
                return;
            }

            spatailWindowState.initialized     = true;
            spatailWindowState.spatialAsset    = spatialAsset;
            spatailWindowState.assignmentState = state;

            var existingWindow = DungeonEditorHelper.GetWindowIfOpen <SpatialConstraintsEditorWindow>();

            // Open a window only if we are assigning
            if (state == SpatialConstraintsEditorAssignmentState.Assigned && existingWindow == null)
            {
                existingWindow = EditorWindow.GetWindow <SpatialConstraintsEditorWindow>();
            }

            if (existingWindow != null)
            {
                existingWindow.Init(spatialAsset, state);
            }
        }
예제 #2
0
        public void Init(SpatialConstraintAsset assetBeingEdited, SpatialConstraintsEditorAssignmentState assignmentState)
        {
            graphEditor = CreateInstance <SpatialConstraintsGraphEditor>();
            var graph = (assetBeingEdited != null) ? assetBeingEdited.Graph : null;

            graphEditor.Init(graph, position);
            graphEditor.AssignmentState  = assignmentState;
            graphEditor.AssetBeingEdited = assetBeingEdited;

            Repaint();
        }