/// <summary> /// Create interface for a PathPoint which allows editing its position and rotation. /// You can also remove the point or focus scene camera on it. /// </summary> private void DrawPathPoints(Path _path) { EditorGUILayout.Space(); GUIStyle style = EditorStatics.GetBoxStyle(0, 0, 5, 0, 5, 5, 5, 5, 400); int _count = _path.Points.Count; for (int _i = 0; _i < _count; _i++) { PathPoint _point = _path.Points[_i]; EditorGUILayout.BeginVertical(style); DrawPathPointsTitle(_point, _i); DrawPathPointsPositionAndRemove(_point, _i, _path); DrawPathPointsRotationAndDisplay(_point); DrawPathPointName(_point); EditorGUILayout.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; } } } } } } }