public KopernicusOrbitRendererData(CelestialBody body, OrbitRendererData data) : base(body) { orbitColor = data.orbitColor; nodeColor = (Color)NodeColor.GetValue(data); lowerCamVsSmaRatio = data.lowerCamVsSmaRatio; upperCamVsSmaRatio = data.upperCamVsSmaRatio; }
// Updates the parameters of OrbitRenderer every frame private void Update() { if (!_driver.celestialBody) { return; } if (!PSystemManager.OrbitRendererDataCache.ContainsKey(_driver.celestialBody)) { return; } if (!_driver.Renderer) { return; } OrbitRendererData originalData = PSystemManager.OrbitRendererDataCache[_driver.celestialBody]; if (!(originalData is KopernicusOrbitRendererData)) { PSystemManager.OrbitRendererDataCache[_driver.celestialBody] = new KopernicusOrbitRendererData(_driver.celestialBody, originalData); } KopernicusOrbitRendererData data = (KopernicusOrbitRendererData)PSystemManager.OrbitRendererDataCache[_driver.celestialBody]; _driver.Renderer.orbitColor = data.orbitColor; _driver.Renderer.nodeColor = data.nodeColor; _driver.Renderer.upperCamVsSmaRatio = data.upperCamVsSmaRatio; _driver.Renderer.lowerCamVsSmaRatio = data.lowerCamVsSmaRatio; }
/// <summary> /// Apply the name changes /// </summary> public void Start() { foreach (CelestialBody b in FlightGlobals.Bodies.Where(b => b.bodyName == oldName)) { OrbitRendererData data = PSystemManager.OrbitRendererDataCache[b]; PSystemManager.OrbitRendererDataCache.Remove(b); b.bodyName = newName; PlanetariumCamera.fetch.targets.Find(t => t.name == oldName).name = newName; data.cb = b; PSystemManager.OrbitRendererDataCache.Add(b, data); Events.OnApplyNameChange.Fire(this, b); } }