Exemplo n.º 1
0
    public void Segment()
    {
        //Segment properties
        GUILayout.BeginHorizontal();
        GUILayout.Label("Length:");
        pipesystem.segmentLength = EditorGUILayout.FloatField(pipesystem.segmentLength);
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        GUILayout.Label("Diameter:");
        pipesystem.segmentDiameter = EditorGUILayout.FloatField(pipesystem.segmentDiameter);
        GUILayout.EndHorizontal();

        GUILayout.Label("Distance to ControlPoint:");
        GUILayout.BeginHorizontal();
        pipesystem.distanceSegmentsControlPoint = GUILayout.HorizontalSlider(pipesystem.distanceSegmentsControlPoint, 0, 50);
        pipesystem.distanceSegmentsControlPoint = EditorGUILayout.FloatField(pipesystem.distanceSegmentsControlPoint);
        GUILayout.EndHorizontal();

        GUILayout.Space(10);

        //Spare segment probability
        GUILayout.Label("Spare Segment Probabilty: " + segmentPrefabCollector.sparePrefabProbability.ToString());

        segmentPrefabCollector.PrefabList();
        segmentPrefabCollector.DragNewArea();
    }
Exemplo n.º 2
0
    public void ControlPoint()
    {
        controlPointPrefabCollector.PrefabList();
        controlPointPrefabCollector.DragNewArea();

        EditorGUI.BeginChangeCheck();
        GUILayout.BeginHorizontal();
        GUILayout.Label("BendPoints: ");
        pipesystem.controlPointBendPoints = EditorGUILayout.IntField(pipesystem.controlPointBendPoints);
        GUILayout.EndHorizontal();

        //recalculate all if controlPointBendPoints has been changed
        if (EditorGUI.EndChangeCheck())
        {
            for (int i = 0; i < pipesystem.controlPointPrefab.Count; i++)
            {
                AssetDatabase.DeleteAsset(AssetDatabase.GetAssetPath(pipesystem.modifiedControlPointPrefab[i]));
            }

            pipesystem.modifiedControlPointPrefab.Clear();

            for (int i = 0; i < pipesystem.controlPointPrefab.Count; i++)
            {
                CreateControlPoint(i);
            }

            pipesystem.recalculateAll = true;
        }

        //delete modified if base is removed
        if (controlPointPrefabCollector.deleteAt != -1)
        {
            AssetDatabase.DeleteAsset(AssetDatabase.GetAssetPath(pipesystem.modifiedControlPointPrefab[controlPointPrefabCollector.deleteAt]));
            pipesystem.modifiedControlPointPrefab.RemoveAt(controlPointPrefabCollector.deleteAt);
            controlPointPrefabCollector.deleteAt = -1;
        }

        //add new
        if (pipesystem.modifiedControlPointPrefab.Count < pipesystem.controlPointPrefab.Count)
        {
            CreateControlPoint(pipesystem.modifiedControlPointPrefab.Count);
        }


        GUILayout.Label("CurveStrength:");
        GUILayout.BeginHorizontal();
        pipesystem.controlPointCurveStrength = GUILayout.HorizontalSlider(pipesystem.controlPointCurveStrength, 0, 1);
        pipesystem.controlPointCurveStrength = EditorGUILayout.FloatField(pipesystem.controlPointCurveStrength);
        GUILayout.EndHorizontal();
    }
Exemplo n.º 3
0
    public void BendSegment()
    {
        bendSegmentPrefabCollector.PrefabList();
        bendSegmentPrefabCollector.DragNewArea();

        EditorGUI.BeginChangeCheck();
        GUILayout.BeginHorizontal();
        GUILayout.Label("BendPoints: ");
        pipesystem.segmentBendPoints = EditorGUILayout.IntField(pipesystem.segmentBendPoints);
        GUILayout.EndHorizontal();

        //recalculate all if controlPointBendPoints has been changed
        if (EditorGUI.EndChangeCheck())
        {
            for (int i = 0; i < pipesystem.bendSegmentPrefab.Count; i++)
            {
                AssetDatabase.DeleteAsset(AssetDatabase.GetAssetPath(pipesystem.modifiedBendSegmentPrefab[i]));
            }

            pipesystem.modifiedBendSegmentPrefab.Clear();

            for (int i = 0; i < pipesystem.bendSegmentPrefab.Count; i++)
            {
                CreateBendSegment(i);
            }

            pipesystem.recalculateAll = true;
        }

        //delete modified if base is removed
        if (bendSegmentPrefabCollector.deleteAt != -1)
        {
            AssetDatabase.DeleteAsset(AssetDatabase.GetAssetPath(pipesystem.modifiedBendSegmentPrefab[bendSegmentPrefabCollector.deleteAt]));
            pipesystem.modifiedBendSegmentPrefab.RemoveAt(bendSegmentPrefabCollector.deleteAt);
            bendSegmentPrefabCollector.deleteAt = -1;
        }

        //add new
        if (pipesystem.modifiedBendSegmentPrefab.Count < pipesystem.bendSegmentPrefab.Count)
        {
            CreateBendSegment(pipesystem.modifiedBendSegmentPrefab.Count);
        }
    }
Exemplo n.º 4
0
 public void Snappable()
 {
     snappablePrefabCollector.PrefabList();
     snappablePrefabCollector.DragNewArea();
 }
Exemplo n.º 5
0
 public void EndPoints()
 {
     endPointPrefabCollector.PrefabList();
     endPointPrefabCollector.DragNewArea();
 }
Exemplo n.º 6
0
 public void Interjacent()
 {
     interjacentPrefabCollector.PrefabList();
     interjacentPrefabCollector.DragNewArea();
 }