Esempio n. 1
0
        void DrawBezierSegmentTest(BezierSegment seg)
        {
            //The start position of the line
            Vector3 lastPos = transform.TransformPoint(seg.A);

            //The resolution of the line
            //Make sure the resolution is adding up to 1, so 0.3 will give a gap at the end, but 0.2 will work
            float resolution = 0.02f;

            //How many loops?
            int loops = Mathf.FloorToInt(1f / resolution);

            for (int i = 1; i < loops; i++)
            {
                //Which t position are we at?
                float t = i * resolution;

                //Find the coordinates between the control points with a Catmull-Rom spline
                Vector3 newPos = SS_Common.DeCasteljausAlgorithm(t, seg);

                //Draw this line segment
                Gizmos.DrawLine(lastPos, newPos);

                //Save this pos so we can draw the next line segment
                lastPos = newPos;
            }
        }
        void DrawNewAreaGUI()
        {
            EditorGUILayout.BeginVertical("Button");

            EditorGUI.indentLevel++;
            showCreateNew.boolValue = EditorGUILayout.Foldout(showCreateNew.boolValue, "Create New Area");
            EditorGUI.indentLevel--;


            if (showCreateNew.boolValue)
            {
                EditorGUILayout.BeginHorizontal();

                EditorGUILayout.LabelField("Name", GUILayout.MaxWidth(50));

                newAreaName = EditorGUILayout.TextField("", newAreaName, GUILayout.MaxWidth(120));

                newColor = EditorGUILayout.ColorField((""), newColor, GUILayout.MaxWidth(60));

                EditorGUILayout.EndHorizontal();

                if (GUILayout.Button("Create Area"))
                {
                    SS_Common.SS_CreateLevelArea(TheTarget.gameObject, newAreaName, newColor);
                    newAreaName = "";
                }
            }
            EditorGUILayout.EndVertical();
        }
Esempio n. 3
0
        private void OnSceneGUI()
        {
            SS_Common.CheckForSwitchDisplayInput(Target.gameObject);

            SS_Common.CheckForLevelCanvasUpdateInput(Target.gameObject);

            SceneGUIDrawShapeSegments();
        }
Esempio n. 4
0
        void GuessModuleSize()
        {
            Vector3 newVec = SS_Common.GetPrefabSize(Target.thePrefabs[0].thePrefab.name, '_');

            if (newVec != Vector3.zero)
            {
                moduleSize.vector3Value = newVec;
            }
        }
Esempio n. 5
0
        void DrawResampledCurve(Color theColor)
        {
            //Draws debug segments
            curveSteps.Clear();
            curveSteps = SS_Common.ResampleCurve(300, elements[0], transform);

            Gizmos.color = theColor;
            for (int i = 0; i < curveSteps.Count - 1; i++)
            {
                DrawLinearSegment(curveSteps[i], curveSteps[i + 1]);
            }
        }
Esempio n. 6
0
        public void AddPrefab()
        {
            SS_GridInstanceObject[] newPrefabs = new SS_GridInstanceObject[thePrefabs.Length + 1];

            for (int i = 0; i < thePrefabs.Length; i++)
            {
                newPrefabs[i] = thePrefabs[i];
            }

            newPrefabs[newPrefabs.Length - 1]           = new SS_GridInstanceObject();
            newPrefabs[newPrefabs.Length - 1].thePrefab = SS_Common.SS_DefaultGridPrefab();
            thePrefabs = newPrefabs;
        }
Esempio n. 7
0
        public void AddPrefab()
        {
            SS_GridObjects[] newPrefabs = new SS_GridObjects[thePrefabs.Length + 1];

            for (int i = 0; i < thePrefabs.Length; i++)
            {
                newPrefabs[i] = thePrefabs[i];
            }

            newPrefabs[newPrefabs.Length - 1]           = new SS_GridObjects();
            newPrefabs[newPrefabs.Length - 1].thePrefab = SS_Common.SS_DefaultScatterPrefab();
            thePrefabs = newPrefabs;
        }
Esempio n. 8
0
        /// <summary>
        ///
        /// </summary>
        /// <returns>a Vector3 in world coordinates </returns>
        public static Vector3 GetWorldPosAtCurvePoint(BezierSegment seg, float dist)
        {
            //Find the total length of the curve
            float totalLength = SS_Common.GetLengthSimpsons(0f, 1f, seg);

            //Use Newton–Raphsons method to find the t value from the start of the curve
            //to the end of the distance we have
            float t = SS_Common.FindTValue(dist, totalLength, seg);

            //Get the coordinate on the Bezier curve at this t value
            Vector3 pos = SS_Common.DeCasteljausAlgorithm(t, seg);

            return(pos);
        }
Esempio n. 9
0
        /// <summary>
        /// CREATE INSTANCER
        /// </summary>
        void DrawCreateInstancer()
        {
            EditorGUILayout.BeginVertical("Button");
            //GUILayout.Space(7);


            EditorGUI.indentLevel++;
            showCreationUI.boolValue = EditorGUILayout.Foldout(showCreationUI.boolValue, "Create Instancer");
            EditorGUI.indentLevel--;

            if (showCreationUI.boolValue)
            {
                EditorGUILayout.PropertyField(currInstancerType, new GUIContent("Type"));

                if (GUILayout.Button("Create"))
                {
                    //Debug.Log("Creating");
                    string theType = currInstancerType.enumNames[currInstancerType.enumValueIndex];
                    //Debug.Log(theType);
                    switch (theType)
                    {
                    case "Floor":
                        SS_Common.SS_CreateFloor(Target.gameObject);
                        break;

                    case "Wall":
                        //Debug.Log("Creating Wall");
                        SS_Common.SS_CreateWall(Target.gameObject);
                        break;

                    case "GridInstance":
                        SS_Common.SS_CreateGridInsts(Target.gameObject);
                        break;

                    case "Scatter":
                        SS_Common.SS_CreateGridScatters(Target.gameObject);
                        break;

                    case "Shape":
                        break;

                    default:
                        break;
                    }
                }
            }

            //GUILayout.Space(7);
            EditorGUILayout.EndVertical();
        }
 public override void OnInspectorGUI()
 {
     //DrawDefaultInspector();
     serializedObject.Update();
     EditorGUI.BeginChangeCheck();
     DrawSelectedKnotInfo();
     DrawResampleUI();
     EditorGUILayout.LabelField(("Length: " + SS_Common.GetCurveLength(Target.elements[0], Target.transform).ToString()));
     if (EditorGUI.EndChangeCheck())
     {
         Undo.RecordObject(Target, "BezierRedraw");
     }
     serializedObject.ApplyModifiedProperties();
 }
Esempio n. 11
0
        public static void DrawInstancerParentUI(GameObject theInstancer)
        {
            EditorGUILayout.BeginVertical("Button");

            EditorGUILayout.BeginHorizontal();

            EditorGUILayout.LabelField("Parent:", GUILayout.Width(50));

            EditorGUILayout.LabelField(theInstancer.transform.parent.name, GUILayout.Width(145));

            SS_Common.UIButtonGameObjectSelect(theInstancer.transform.parent.gameObject);

            EditorGUILayout.EndHorizontal();

            EditorGUILayout.EndVertical();
        }
Esempio n. 12
0
        /// <summary>
        /// Return the next prefab with all valid modifications applied
        /// </summary>
        /// <returns></returns>
        GameObject GetNextPrefab()
        {
            GameObject returnGO;

            if (theWallPrefabs.Length > 1)
            {
                switch (myDistrType)
                {
                case (DistributionType.Random):
                    currSequenceIndex = Random.Range(0, theWallPrefabs.Length);
                    returnGO          = UnityEditor.PrefabUtility.InstantiatePrefab(theWallPrefabs[currSequenceIndex].thePrefab as GameObject) as GameObject;
                    break;

                case (DistributionType.Sequence):
                    int theIndex = currSequenceIndex;
                    currSequenceIndex++;
                    if (currSequenceIndex == theWallPrefabs.Length)
                    {
                        currSequenceIndex = 0;
                    }
                    returnGO = UnityEditor.PrefabUtility.InstantiatePrefab(theWallPrefabs[theIndex].thePrefab as GameObject) as GameObject;
                    break;

                default:
                    returnGO = UnityEditor.PrefabUtility.InstantiatePrefab(theWallPrefabs[0].thePrefab as GameObject) as GameObject;
                    break;
                }
            }
            else
            {
                currSequenceIndex = 0;
                returnGO          = UnityEditor.PrefabUtility.InstantiatePrefab(theWallPrefabs[0].thePrefab as GameObject) as GameObject;
            }
            if (returnGO == null)
            {
                returnGO = SS_Common.SS_DefaultWallPrefab();
            }

            //Assign the parent
            returnGO.transform.SetParent(transform);

            //Assign the scale
            returnGO.transform.localScale = new Vector3(segmentScale, 1, segmentScale);


            return(returnGO);
        }
Esempio n. 13
0
 void DrawResampledCurve()
 {
     //Draws debug segments
     curveSteps.Clear();
     curveSteps = SS_Common.ResampleCurve(numSteps, elements[0], transform);
     for (int i = 0; i < curveSteps.Count - 1; i++)
     {
         if (i % 2 == 0)
         {
             Gizmos.color = Color.white;
         }
         else
         {
             Gizmos.color = Color.black;
         }
         DrawLinearSegment(curveSteps[i], curveSteps[i + 1]);
     }
 }
Esempio n. 14
0
        //Divide the curve into equal steps
        public void DivideSegmentIntoSteps(BezierSegment seg)
        {
            //Find the total length of the curve
            float totalLength = SS_Common.GetLengthSimpsons(0f, 1f, seg);

            //How many sections do we want to divide the curve into
            int parts = numSteps;

            //reset the curve steps Array                                               <======= EDIT MIO
            segmentSteps.Clear();
            segmentSteps.Add(transform.TransformPoint(seg.A));


            //What's the length of one section?
            float sectionLength = totalLength / (float)parts;

            //Init the variables we need in the loop
            float currentDistance = 0f + sectionLength;

            //The curve's start position
            Vector3 lastPos = seg.A;

            for (int i = 1; i <= parts; i++)
            {
                //Use Newton–Raphsons method to find the t value from the start of the curve
                //to the end of the distance we have
                float t = SS_Common.FindTValue(currentDistance, totalLength, seg);

                //Get the coordinate on the Bezier curve at this t value
                Vector3 pos = SS_Common.DeCasteljausAlgorithm(t, seg);


                //Save the last position
                lastPos = pos;

                //Add current pos to vector list                                                        <======= EDIT MIO
                segmentSteps.Add(transform.TransformPoint(pos));

                //Add to the distance traveled on the line so far
                currentDistance += sectionLength;
            }
        }
        void DrawAreaName()
        {
            EditorGUILayout.BeginVertical("Button");
            GUILayout.Space(7);
            serializedObject.Update();

            EditorGUI.BeginChangeCheck();

            EditorGUILayout.PropertyField(myName, new GUIContent("Grid Name"));

            serializedObject.ApplyModifiedProperties();

            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(Target, "Change Area Name");
                SS_Common.RenameArea("SS_Grid", myName.stringValue, Target.transform);
            }
            GUILayout.Space(7);
            EditorGUILayout.EndVertical();
        }
Esempio n. 16
0
        void DrawExistingSubAreasGUI(SS_LevelArea[] allAreas)
        {
            if (allAreas != null && allAreas.Length > 0)
            {
                for (int i = 0; i < allAreas.Length; i++)
                {
                    EditorGUILayout.BeginVertical("Button");

                    EditorGUILayout.BeginHorizontal();

                    EditorGUILayout.LabelField(allAreas[i].name);

                    SS_Common.UIButtonGameObjectSelect(allAreas[i].gameObject);
                    SS_Common.UIButtonGameObjectDelete(allAreas[i].gameObject);

                    EditorGUILayout.EndHorizontal();

                    EditorGUILayout.EndVertical();
                }
            }
        }
Esempio n. 17
0
        void Start()
        {
            GameObject cube = GameObject.CreatePrimitive(PrimitiveType.Cube);

            cube.transform.position = SS_Common.GetLineIntersection(p0.position, p1.position, q0.position, q1.position);
        }
Esempio n. 18
0
        public override void OnInspectorGUI()
        {
            EditorGUI.BeginChangeCheck();

            Space();

            serializedObject.Update();

            EditorGUILayout.PropertyField(theShapeTransform);

            serializedObject.ApplyModifiedProperties();

            EditorGUILayout.LabelField("Main Options", SS_Common.StyleTitle);

            // AREA NAME
            DrawAreaName();

            // AREA PARENT
            SS_Common.DrawInstancerParentUI(Target.gameObject);


            // SEGMENTS OPTIONS
            DrawTransformOffsetsFoldout();


            Space();
            Space();
            EditorGUILayout.LabelField("Wall Options", SS_Common.StyleTitle);
            // COLLIDER OPTIONS
            DrawColliderOptions();

            // SEGMENTS OPTIONS
            DrawSegmentOptions();

            Space();
            Space();

            EditorGUILayout.LabelField("Walls", SS_Common.StyleTitle);


            // PREFAB OPTIONS
            DrawPrefabOptions();

            //DISTRIBUTION OPTIONS
            if (GetWallPrefabArraySize().intValue > 1)
            {
                DrawDistributionOptions();
            }

            // PREFAB OPTIONS FOLDOUT
            DrawPrefabArrayFoldout();


            Space();
            Space();

            EditorGUILayout.LabelField("Corners", SS_Common.StyleTitle);

            DrawCornerArrayFoldout();


            Space();
            Space();
            ////////////////////////
            // HOLES OPTIONS
            ///////////////////////
            EditorGUILayout.LabelField("Holes", SS_Common.StyleTitle);

            DrawHolesOptions();

            /////////////////////////////////////////////////

            serializedObject.ApplyModifiedProperties();
            /////////////////////////////////////////////////
            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(Target, "Moved Point");
                Target.GeneratePrefabs();
            }
        }
        public override void OnInspectorGUI()
        {
            EditorGUI.BeginChangeCheck();

            serializedObject.Update();

            /////////////////////////////////////////////////
            /////////////////////////////////////////////////
            /////////////////////////////////////////////////
            Space();

            EditorGUILayout.LabelField("Main Options", SS_Common.StyleTitle);

            //Area NAme UI
            DrawAreaName();

            //Draw Parent Name
            SS_Common.DrawInstancerParentUI(Target.gameObject);

            // TRANSFORM OPTIONS FOLDOUT
            DrawTransformOffsetsFoldout();

            Space();
            Space();
            EditorGUILayout.LabelField("Grid Options", SS_Common.StyleTitle);


            DrawGridSizeOptions();

            DrawRandomProbabilityOptions();

            DrawGridBorderOptions();


            Space();
            Space();
            EditorGUILayout.LabelField("Prefabs", SS_Common.StyleTitle);


            EditorGUILayout.BeginVertical("Button");
            Space();
            EditorGUILayout.PrefixLabel("Prefabs Options");

            DrawPrefabOptions();


            //DISTRIBUTION OPTIONS
            if (GetPrefabArraySize().intValue > 1)
            {
                DrawDistributionOptions();
            }

            // PREFAB OPTIONS FOLDOUT
            DrawPrefabArrayFoldout();
            Space();

            EditorGUILayout.EndVertical();


            /////////////////////////////////////////////////
            /////////////////////////////////////////////////


            /*
             * EditorGUILayout.BeginVertical("Button");
             *
             * GUILayout.Space(7);
             * //GUILayout.Label("");
             * EditorGUILayout.PropertyField(GetPrefabArraySize());
             * GUILayout.Space(7);
             *
             * EditorGUILayout.EndVertical();
             *
             * for (int i = 0; i < GetPrefabArraySize().intValue; i++)
             * {
             *  EditorGUILayout.BeginVertical("Button");
             *
             *  GUILayout.Space(7);
             *  SerializedProperty theProp = GetPrefabArrayAtIndex(i);
             *  EditorGUILayout.PropertyField(GetPrefabGO(theProp));
             *  GUILayout.Space(7);
             *
             *  EditorGUILayout.EndVertical();
             * }
             */



            serializedObject.ApplyModifiedProperties();

            /////////////////////////////////////////////////
            /////////////////////////////////////////////////

            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(Target, "Moved Point");
                Target.GeneratePrefabs();
            }
        }
Esempio n. 20
0
        /*   RECALCULATE SMOOTH
         *  Algorithm based on : http://www.efg2.com/Lab/Graphics/Jean-YvesQueinecBezierCurves.htm
         */

        void RecalculateSmoothKnot(ShapeElement element, int knotIndex)
        {
            //Debug.Log("recalculating index " + knotIndex.ToString());
            //Local Variables

            bool isLast  = (knotIndex == element.knots.Length - 1);
            bool isFirst = (knotIndex == 0);


            if (!isLast && !isFirst)
            {
                //GET THE POINTS TO BE USED

                Vector3 k0Pos = element.knots[knotIndex - 1].KWorldPos(transform);
                Vector3 k1Pos = element.knots[knotIndex].KWorldPos(transform);
                Vector3 k2Pos = element.knots[knotIndex + 1].KWorldPos(transform);


                //GET THE OFFSETED LINE

                //Get base Vector
                Vector3 BaseVec           = k0Pos - k2Pos;
                float   baseVecHalfLenght = Vector3.Magnitude(BaseVec) / 2;

                Vector3 q0 = k1Pos + Vector3.Normalize(BaseVec) * baseVecHalfLenght;
                Vector3 q1 = k1Pos + Vector3.Normalize(-BaseVec) * baseVecHalfLenght;



                //GET THE IN TANGENT

                //GET k2-k1 Vector3

                Vector3 k2k1Vec = k2Pos - k1Pos;

                //Get the smoothed point dist
                float smoothPoint = k2k1Vec.magnitude / 4;

                Vector3 pIn0 = k1Pos + Vector3.Normalize(k2k1Vec) * smoothPoint;
                Vector3 pIn1 = Vector3.Lerp(k0Pos, k1Pos, 0.5f);

                Vector3 inTangent = SS_Common.GetLineIntersection(q0, q1, pIn0, pIn1);

                //ASSIGN THE TANGENT
                element.knots[knotIndex].kHandleIn = inTangent - k1Pos;



                //GET THE OUT TANGENT

                Vector3 k0k1Vec = k0Pos - k1Pos;

                //Get the smoothed point dist
                smoothPoint = k0k1Vec.magnitude / 4;

                Vector3 pOut0 = k1Pos + Vector3.Normalize(k0k1Vec) * smoothPoint;
                Vector3 pOut1 = Vector3.Lerp(k1Pos, k2Pos, 0.5f);


                Vector3 outTangent = SS_Common.GetLineIntersection(q0, q1, pOut0, pOut1);

                //ASSIGN THE TANGENT
                element.knots[knotIndex].kHandleOut = k1Pos - outTangent;
            }



            if (isFirst)    //We only calculate the OutTangent
            {
                Vector3 k0Pos = element.knots[0].KWorldPos(transform);
                Vector3 k1Pos = element.knots[1].KWorldPos(transform);
                Vector3 k2Pos = element.knots[2].KWorldPos(transform);

                //FIRST LINE P
                //Midpoint of knot[0] , knot[1]   = "P0"
                Vector3 p0 = Vector3.Lerp(k0Pos, k1Pos, 0.5f);

                //Dir of   knot[2] - knot[1]  = k2k1Dir
                Vector3 k2k1Dir = k2Pos - k1Pos;

                //Half distance between knot[2] - knot[1] = k2k1halfDist
                float k2k1HalfDist = k2k1Dir.magnitude / 2;

                //Get Point starting at "P0" traveling "k2k1halfDist" in "k2k1Dir" direction = "P1"
                Vector3 p1 = p0 + Vector3.Normalize(k2k1Dir) * k2k1HalfDist;

                //SECOND LINE K
                //K0 = knot[0]
                Vector3 q0 = k0Pos;

                //Get vector from knot[0] to knot[2] = "k0k2Vector"
                Vector3 k0k2Vector = k2Pos - k0Pos;

                //Get a quarter of the length of "k0k1Vector" = "smoothLength"
                float smoothLength = Vector3.Magnitude(k0k2Vector) / 4;

                //K1 = Starting at P1 travel "smoothLength" along  "k0k2Vector" direction
                Vector3 q1 = p1 + Vector3.Normalize(k0k2Vector) * smoothLength;

                //GET INTERSECTION
                Vector3 intersection = SS_Common.GetLineIntersection(p0, p1, q0, q1);

                element.knots[0].kHandleOut = intersection - k0Pos;
            }

            if (isLast) //We only calculate the inTangent
            {
                Vector3 k0Pos = element.knots[knotIndex].KWorldPos(transform);
                Vector3 k1Pos = element.knots[knotIndex - 1].KWorldPos(transform);
                Vector3 k2Pos = element.knots[knotIndex - 2].KWorldPos(transform);

                //FIRST LINE P
                //Midpoint of knot[0] , knot[1]   = "P0"
                Vector3 p0 = Vector3.Lerp(k0Pos, k1Pos, 0.5f);

                //Dir of   knot[2] - knot[1]  = k2k1Dir
                Vector3 k2k1Dir = k2Pos - k1Pos;

                //Half distance between knot[2] - knot[1] = k2k1halfDist
                float k2k1HalfDist = k2k1Dir.magnitude / 2;

                //Get Point starting at "P0" traveling "k2k1halfDist" in "k2k1Dir" direction = "P1"
                Vector3 p1 = p0 + Vector3.Normalize(k2k1Dir) * k2k1HalfDist;

                //SECOND LINE K
                //K0 = knot[0]
                Vector3 q0 = k0Pos;

                //Get vector from knot[0] to knot[2] = "k0k2Vector"
                Vector3 k0k2Vector = k2Pos - k0Pos;

                //Get a quarter of the length of "k0k1Vector" = "smoothLength"
                float smoothLength = Vector3.Magnitude(k0k2Vector) / 4;

                //K1 = Starting at P1 travel "smoothLength" along  "k0k2Vector" direction
                Vector3 q1 = p1 + Vector3.Normalize(k0k2Vector) * smoothLength;

                //GET INTERSECTION
                Vector3 intersection = SS_Common.GetLineIntersection(p0, p1, q0, q1);


                element.knots[knotIndex].kHandleIn = intersection - k0Pos;
            }
        }
Esempio n. 21
0
 public Vector3[] thePoints()
 {
     curveSteps.Clear();
     curveSteps = SS_Common.ResampleCurve(numSteps, elements[0], transform);
     return(curveSteps.ToArray());
 }
Esempio n. 22
0
        void OnDrawGizmos()
        {
            //The Bezier curve's color
            Gizmos.color = curveColor;

            //Draw Each Element
            for (int i = 0; i < elements.Length; i++)
            {
                //Debug.Log("Element "+ i);
                //DrawElement(elements[i]);
            }

            curveSteps.Clear();
            curveSteps = SS_Common.ResampleCurve(numSteps, elements[0], transform);
            for (int i = 0; i < curveSteps.Count - 1; i++)
            {
                Gizmos.color = Color.black;
                Gizmos.DrawIcon(transform.position, "Light Gizmo.tiff", true);
            }


            Gizmos.color = Color.green;

            /*
             * //Draw Each Element
             * for (int i = 0; i < elements.Length; i++)
             * {
             *  //Debug.Log("Element "+ i);
             *  DrawElement(elements[i]);
             *  Gizmos.DrawIcon(transform.position, "Light Gizmo.tiff", true);
             * }*/



#if UNITY_EDITOR
            if (UnityEditor.Selection.activeGameObject != gameObject)
            {
                DrawResampledCurve(curveColor);
            }
            else
            {
                //Draw Each Element
                for (int i = 0; i < elements.Length; i++)
                {
                    //Debug.Log("Element "+ i);
                    DrawElement(elements[i]);
                }
            }
#endif

            if (showResampleUI)
            {
                DrawResampledCurve();
            }

            if (creatingKnot)
            {
                //Debug.Log("Moving created knot");
                Vector3 newTargetPosition = MousePosRoutine();
                Vector3 newPointPosition  = new Vector3(newTargetPosition.x - transform.position.x, 0, newTargetPosition.z - transform.position.z);
                createdKnot.kPos = newPointPosition;
            }
        }
Esempio n. 23
0
        public override void OnInspectorGUI()
        {
            EditorGUI.BeginChangeCheck();

            serializedObject.Update();


            Space();

            EditorGUILayout.LabelField("Main Options", SS_Common.StyleTitle);

            DrawAreaName();

            SS_Common.DrawInstancerParentUI(Target.gameObject);


            // TRANSFORM OPTIONS FOLDOUT
            DrawTransformOffsetsFoldout();


            Space();
            Space();
            EditorGUILayout.LabelField("Floor Options", SS_Common.StyleTitle);

            // COLLIDER OPTIONS
            DrawColliderOptions();



            Space();
            Space();

            EditorGUILayout.LabelField("Prefabs", SS_Common.StyleTitle);

            // PREFABS OPTIONS
            EditorGUILayout.BeginVertical("Button");
            Space();
            EditorGUILayout.PrefixLabel("Prefabs Options");

            DrawPrefabOptions();


            //DISTRIBUTION OPTIONS
            if (GetPrefabArraySize().intValue > 1)
            {
                DrawDistributionOptions();
            }

            // PREFAB OPTIONS FOLDOUT
            DrawPrefabArrayFoldout();
            Space();

            EditorGUILayout.EndVertical();



            serializedObject.ApplyModifiedProperties();
            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(Target, "Moved Point");
                Target.GeneratePrefabs();
            }
        }
Esempio n. 24
0
        public override void OnInspectorGUI()
        {
            EditorGUI.BeginChangeCheck();
            serializedObject.Update();

            Space();

            EditorGUILayout.LabelField("Main Options", SS_Common.StyleTitle);

            // AREA NAME
            DrawAreaName();

            // AREA PARENT
            SS_Common.DrawInstancerParentUI(Target.gameObject);


            // SEGMENTS OPTIONS
            DrawTransformOffsetsFoldout();


            Space();
            Space();
            EditorGUILayout.LabelField("Scatter Options", SS_Common.StyleTitle);
            serializedObject.Update();

            EditorGUILayout.PropertyField(scatterCount);

            EditorGUILayout.PropertyField(randSeed);

            EditorGUILayout.PropertyField(wallOffset);

            EditorGUILayout.PropertyField(randomRotation);

            EditorGUILayout.PropertyField(avoidSelfCollision);


            serializedObject.ApplyModifiedProperties();

            Space();
            Space();

            EditorGUILayout.LabelField("Prefabs", SS_Common.StyleTitle);


            // PREFAB OPTIONS
            DrawPrefabOptions();

            //DISTRIBUTION OPTIONS
            if (GetPrefabArraySize().intValue > 1)
            {
                DrawDistributionOptions();
            }

            // PREFAB OPTIONS FOLDOUT
            DrawPrefabArrayFoldout();


            /*
             *
             * EditorGUILayout.PropertyField(serializedObject.FindProperty("thePrefabs"));
             * EditorGUILayout.PropertyField(GetPrefabArraySize());
             *
             * for (int i = 0; i < GetPrefabArraySize().intValue; i++)
             * {
             *  SerializedProperty theProp = GetPrefabArrayAtIndex(i);
             *
             *  EditorGUILayout.PropertyField(theProp);
             *  EditorGUILayout.PropertyField(GetPrefabGO(theProp));
             *  EditorGUILayout.PropertyField(GetPrefabSize(theProp));
             *
             * }
             *
             * EditorGUILayout.PropertyField(scatterCount);
             */

            serializedObject.ApplyModifiedProperties();

            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(Target, "Moved Point");
                Target.GeneratePrefabs();
            }
        }
Esempio n. 25
0
        private void OnSceneGUI()
        {
            SS_Common.CheckForSwitchDisplayInput(TheTarget.gameObject);

            SS_Common.CheckForLevelCanvasUpdateInput(TheTarget.gameObject);
        }