/// <summary> /// Draws interface for every spawn point. /// </summary> private void SpawnPointsDraw() { int spawnPointCount = GetCount(); GUIStyle _style = EditorStatics.GetBoxStyle(20, 0, 0, 0, 15, 15, 15, 15, 485); for (int _i = 0; _i < spawnPointCount; _i++) { SpawnPoint _point = so.Collection.Points[_i]; GUILayout.BeginVertical(_style); if (pointStyle == null) { pointStyle = new GUIStyle(EditorStyles.boldLabel); } EditorGUILayout.BeginHorizontal(); EditorStatics.GUIPreColor = EditorStyles.label.normal.textColor; pointStyle.normal.textColor = Color.white; EditorGUILayout.LabelField(EditorStatics.StringMiddleMark, pointStyle, GUILayout.Width(20)); pointStyle.normal.textColor = EditorStatics.GUIPreColor; string _displayName = so.Collection.Points[_i].Name + " ID: " + _point.ID; _point.Foldout = EditorGUILayout.Foldout(_point.Foldout, _displayName); SpawnPointListOrder(GetCount(), _i); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); // Remove, focus, gizmos, keyboard if (EditSpawnPointHeaderButtons(_point, _i)) { EditorGUILayout.EndHorizontal(); GUILayout.EndVertical(); return; } EditorGUILayout.EndHorizontal(); // Do not show the spawn point if (!_point.Foldout) { GUILayout.EndVertical(); continue; } EditorGUILayout.Space(); EditSpawnPointInfo(_point); PathInterface(_point); GUILayout.EndVertical(); } }
//////////////////////////////////////////////////////////////////////// #region Gizmo private void DrawGizmos(Camera camera) { if (so.Collection == null || so.Collection.Points == null) { return; } List <SpawnPoint> _points = so.Collection.Points; int _count = GetCount(); for (int _i = 0; _i < _count; _i++) { SpawnPoint _spawnPoint = _points[_i]; // Spawn point is toggled if (_spawnPoint.IsDisplayingGizmo) { if (_spawnPoint.IsDisplayingLabel) { DrawTextureInfo(_i, _spawnPoint.Position); } if (_spawnPoint.IsDisplayingMesh) { DrawObject( camera, _spawnPoint.Position, _spawnPoint.Rotation ); } // All paths in a spawn point int _countPaths = _spawnPoint.Paths.Count; for (int _j = 0; _j < _countPaths; _j++) { Path _path = _spawnPoint.Paths[_j]; int _pathPointsCount = _path.Points.Count; // Draw line from spawn point to path position if (_pathPointsCount > 0) { handlesLineStartColor = Handles.color; Handles.color = _spawnPoint.ColorGizmo; Handles.DrawLine( _path.GetZeroPointPosition() + pathLineOffset, _spawnPoint.Position + pathLineOffset ); Handles.color = handlesLineStartColor; } // Path in a spawn point is toggled if (_path.IsDisplayingGizmo) { // All path _so.Collection.Points in a path for (int _k = 0; _k < _pathPointsCount; _k++) { PathPoint _pathPoint = _path.Points[_k]; if (_pathPoint.IsDisplayingMesh) { DrawObject( camera, _pathPoint.Position, _pathPoint.Rotation ); } if (_path.IsDisplayingLabel) { // Path point info if (_k != 0) { DrawTextureInfo(_j, _k, _pathPoint.Position); } } // Draw a line from start to end point if (_k < _pathPointsCount - 1) { handlesLineStartColor = Handles.color; Handles.color = _path.PathColor; Handles.DrawLine( _pathPoint.Position + pathLineOffset, _path.Points[_k + 1].Position + pathLineOffset ); Handles.color = handlesLineStartColor; } } } } } } }