public override void OnInspectorGUI() { Piece = (StrokeModularPiece)target; // target var TempPiece = (StrokeModularPiece)Piece; StrokeModularPiece[] Pieces = new StrokeModularPiece[targets.Length]; RenderHeader("Stroke Settings"); RenderProperty <StrokeType, StrokeModularPiece> ("_StrokeType", "Stroke Type", "This variable determines what stroke type this stroke modular piece is.", (val, GUIContent, returnCallback) => { returnCallback.Invoke((StrokeType)EditorGUILayout.EnumPopup(GUIContent, (StrokeType)val)); }); RenderProperty <StrokeCategory, StrokeModularPiece> ("_StrokeCategory", "Stroke Category", "This variable determines what category this stroke piece belongs to.", (val, GUIContent, returnCallback) => { returnCallback.Invoke((StrokeCategory)EditorGUILayout.EnumPopup(GUIContent, (StrokeCategory)val)); }); if (Pieces.Length == 1) { RenderList <Modular.ConnectionDirection> (ref TempPiece._ConnectionDirections, ref ConnectionsOpen, "Connection Directions", "", (Modular.ConnectionDirection Type, int Index) => { TempPiece._ConnectionDirections[Index] = (ConnectionDirection)EditorGUILayout.EnumPopup(new GUIContent("Connection: " + Index), TempPiece.ConnectionDirections[Index]); }, () => { return(Modular.ConnectionDirection.Front); }); if (TempPiece != null) { RenderHeader("Stroke Debug Settings"); EditorGUILayout.LabelField("Current Stroke Connections: " + TempPiece.CurrentlyConnected.Length); if (TempPiece.CurrentlyConnected.Length > 0) { if (GUILayout.Button("Draw Current Connections")) { TempPiece.DebugConnections(1f); } } } } base.OnInspectorGUI(); // draw base }
public void Enter(List <object> GenData = null) { System = GenData.Find <ModularBuildingSystem> (true); // create link to Modular building system var Getters = GenData.Find <System.Func <StrokeType, ModularPlacableObject>[]>(true); OriginSetData = GenData.Find <ModularStrokeSetData>(true); OnCanceledCallback = GenData.Find <System.Action <object[]> >(true); // set on cancle callback var PlacedDelete = GenData.Find <System.Action <ModularPlacableObject>[]> (true); OnPlaced = PlacedDelete [0]; OnDeleted = PlacedDelete[1]; // set on cancle callback CanPlace = GenData.Find <System.Func <int, bool> >(true); ModularInfoGetter = Getters [0]; ModularInstanceGetter = Getters [1]; OriginPlacable = (StrokeModularPiece)ModularInfoGetter(StrokeType.Straight); Distance = OriginPlacable.Scale; // set renderset RenderSet = OriginPlacable.RenderSet; CrossRenderSet = Management.GameManager.I.Modular.CrossPrefab.GetComponent <RenderSet> (); Init(); }