public void Save() { mf.Tls.SaveProperty("Coverage" + IDname, Coverage.ToString()); mf.Tls.SaveProperty("CoverageUnits" + IDname, CoverageUnits.ToString()); mf.Tls.SaveProperty("TankRemaining" + IDname, TankRemaining.ToString()); mf.Tls.SaveProperty("QuantityApplied" + IDname, cQuantityApplied.ToString()); mf.Tls.SaveProperty("QuantityUnits" + IDname, QuantityUnits.ToString()); mf.Tls.SaveProperty("LastAccQuantity" + IDname, LastAccQuantity.ToString()); mf.Tls.SaveProperty("RateSet" + IDname, cRateSet.ToString()); mf.Tls.SaveProperty("RateAlt" + IDname, cRateAlt.ToString()); mf.Tls.SaveProperty("FlowCal" + IDname, FlowCal.ToString()); mf.Tls.SaveProperty("TankSize" + IDname, TankSize.ToString()); mf.Tls.SaveProperty("ValveType" + IDname, ValveType.ToString()); mf.Tls.SaveProperty("cSimulationType" + IDname, cSimulationType.ToString()); mf.Tls.SaveProperty("ProductName" + IDname, cProductName); mf.Tls.SaveProperty("KP" + IDname, PIDtoArduino.KP.ToString()); mf.Tls.SaveProperty("KI" + IDname, PIDtoArduino.KI.ToString()); mf.Tls.SaveProperty("PIDMinPWM" + IDname, PIDtoArduino.MinPWM.ToString()); mf.Tls.SaveProperty("PIDLowMax" + IDname, PIDtoArduino.LowMax.ToString()); mf.Tls.SaveProperty("PIDHighMax" + IDname, PIDtoArduino.HighMax.ToString()); mf.Tls.SaveProperty("PIDdeadband" + IDname, PIDtoArduino.DeadBand.ToString()); mf.Tls.SaveProperty("PIDbrakepoint" + IDname, PIDtoArduino.BrakePoint.ToString()); mf.Tls.SaveProperty("TimedAdjustment" + IDname, PIDtoArduino.TimedAdjustment.ToString()); mf.Tls.SaveProperty("UseMultiPulse" + IDname, cUseMultiPulse.ToString()); mf.Tls.SaveProperty("CountsRev" + IDname, cCountsRev.ToString()); mf.Tls.SaveProperty("ModuleID" + IDname, cModID.ToString()); mf.Tls.SaveProperty("SensorID" + IDname, cSenID.ToString()); mf.Tls.SaveProperty("OffRateAlarm" + IDname, cUseOffRateAlarm.ToString()); mf.Tls.SaveProperty("OffRateSetting" + IDname, cOffRateSetting.ToString()); mf.Tls.SaveProperty("MinUPM" + IDname, cMinUPM.ToString()); mf.Tls.SaveProperty("VariableRate" + IDname, cVariableRate.ToString()); }
public static GameObject CreateLodData(int lodIdx, int lodCount, GameObject attachGO, float baseVertDensity, SimType simType, Dictionary <System.Type, SimSettingsBase> cachedSettings) { var go = attachGO ?? new GameObject(string.Format("{0}Cam{1}", simType.ToString(), lodIdx)); if (attachGO == null) { // Add component if we are creating a loddata GO anew go.AddComponent <LodTransform>().InitLODData(lodIdx, lodCount);; } LodData sim; switch (simType) { case SimType.AnimatedWaves: sim = go.AddComponent <LodDataAnimatedWaves>(); go.AddComponent <LodDataSeaFloorDepth>(); go.AddComponent <ReadbackLodData>(); break; case SimType.DynamicWaves: sim = go.AddComponent <LodDataDynamicWaves>(); break; case SimType.Foam: sim = go.AddComponent <LodDataFoam>(); break; case SimType.Flow: sim = go.AddComponent <LodDataFlow>(); go.AddComponent <ReadbackLodData>(); break; case SimType.Shadow: sim = go.AddComponent <LodDataShadow>(); break; default: Debug.LogError("Unknown sim type: " + simType.ToString()); return(null); } // create a shared settings object if one doesnt already exist SimSettingsBase settings; if (!cachedSettings.TryGetValue(sim.GetType(), out settings)) { settings = sim.CreateDefaultSettings(); cachedSettings.Add(sim.GetType(), settings); } sim.UseSettings(settings); if (attachGO == null) { // Add components if we are creating a loddata GO anew var cam = go.AddComponent <Camera>(); cam.clearFlags = sim.CamClearFlags; cam.backgroundColor = new Color(0f, 0f, 0f, 0f); cam.cullingMask = 0; cam.orthographic = true; cam.nearClipPlane = 1f; cam.farClipPlane = 500f; cam.renderingPath = RenderingPath.Forward; cam.useOcclusionCulling = false; cam.allowHDR = true; cam.allowMSAA = false; cam.allowDynamicResolution = false; var cart = go.AddComponent <CreateAssignRenderTexture>(); cart._targetName = go.name; cart._width = cart._height = (int)(4 * baseVertDensity); cart._depthBits = 0; cart._format = sim.TextureFormat; cart._wrapMode = TextureWrapMode.Clamp; cart._antiAliasing = 1; cart._filterMode = FilterMode.Bilinear; cart._anisoLevel = 0; cart._useMipMap = false; cart._createPingPongTargets = sim as LodDataPersistent != null; cart.Create(); var apply = go.AddComponent <ApplyLayers>(); apply._cullIncludeLayers = new string[] { string.Format("LodData{0}", simType.ToString()) }; } return(go); }