private void Initialize(ILevelControllerOptions options) { // Constructs all the in-level components, then stores the ones that'll be needed later in member variables. // Done this way rather than directly initializing the member variables because this way if they're reordered, // the compiler will complain if something's being constructed before its dependency. var surface = GeodesicSphereFactory.Build(options); var simulation = new SimulationController(surface, options); var cameraController = new CameraController(options); var meshManager = new MeshManager(surface); var cursorTracker = new CursorTracker(cameraController.Camera, meshManager); var fieldManipulator = new FieldManipulator(surface, cursorTracker, options); var colorMapView = new ColorMapView(surface, meshManager.Mesh, options); var particleMapView = new ParticleMapView(surface, options); var rawValuesView = new RawValuesView(cursorTracker); var timeDilationView = new TimeView(50, options.Timestep); var latLongGridView = new LatLongGridView(options.Radius); _simulationController = simulation; _colorMapView = colorMapView; _particleMapView = particleMapView; _rawValuesView = rawValuesView; _timeView = timeDilationView; _latLongGridView = latLongGridView; _cameraController = cameraController; _cursorTracker = cursorTracker; _fieldManipulator = fieldManipulator; }
/// <summary> /// Creates a simulation with the specified options, along with all the additional structures needed to display /// and interact with it. /// </summary> /// <param name="options">The options to use in creating the simulation</param> public LevelController(ILevelControllerOptions options) { Initialize(options); }