private bool startMenuOverlay() { if (!Misc.Parse(SettingsManager.GetValue("ShowInMenu"), true)) { return(false); } setUpMesh(); var objects = GameObject.FindObjectsOfType(typeof(GameObject)); if (objects.Any(o => o.name == "LoadingBuffer")) { return(false); } var kerbin = objects.OfType <GameObject>().Where(b => b.name == "Kerbin").LastOrDefault(); if (kerbin == null) { Debug.LogWarning("[Kethane] Couldn't find Kerbin!"); return(false); } gameObject.layer = kerbin.layer; gameObject.transform.parent = kerbin.transform; gameObject.transform.localPosition = Vector3.zero; gameObject.transform.localRotation = Quaternion.identity; gameObject.transform.localScale = Vector3.one * 1020; gameObject.renderer.enabled = true; var random = new System.Random(); var colors = new Color32[mesh.vertexCount]; foreach (var cell in Cell.AtLevel(MapOverlay.GridLevel)) { var rand = random.Next(100); Color32 color; if (rand < 16) { color = rand < 4 ? new Color32(21, 176, 26, 255) : colorEmpty; foreach (var neighbor in cell.GetNeighbors(MapOverlay.GridLevel)) { if (random.Next(2) < 1) { setCellColor(neighbor, color, colors); } } } else { color = colorUnknown; } setCellColor(cell, color, colors); } mesh.colors32 = colors; return(true); }
static MapOverlay() { controlWindowPos.x = Misc.Parse(SettingsManager.GetValue("WindowLeft"), 200f); controlWindowPos.y = Misc.Parse(SettingsManager.GetValue("WindowTop"), 200f); ShowOverlay = Misc.Parse(SettingsManager.GetValue("ShowOverlay"), true); }
private static IEnumerable <ResourceRate> loadRates(ConfigNode config) { return((config ?? new ConfigNode()).values.Cast <ConfigNode.Value>().Where(v => PartResourceLibrary.Instance.resourceDefinitions.Any(d => d.name == v.name)).Select(v => new ResourceRate(v.name, Misc.Parse(v.value, 0.0))).Where(r => r.Rate > 0)); }