void OnTriggerStay(Collider col) { if (col != null && col.attachedRigidbody != null && (!spawn_space_check.Started || spawn_space_check.Remaining < spawn_space_check.Period / 2)) { if (col.CompareTag("Untagged")) { var p = col.attachedRigidbody.GetComponent <Part>(); if (p != null && p.vessel != null && p.vessel != vessel) { spawn_space_check.Restart(); } } } }
void OnTriggerStay(Collider col) { if (col != null && col.attachedRigidbody != null && (!check_timer.Started || check_timer.Remaining < check_timer.Period / 2)) { if (col.CompareTag("Untagged")) { var p = col.attachedRigidbody.GetComponent <Part>(); if (p != null && p.vessel != null && p.vessel != vessel) { check_timer.Restart(); on_trigger?.Invoke(p); } } } }
static IEnumerator <char> indicator_seq() { const string clock = "◐◓◑◒"; var clen = clock.Length; var timer = new RealTimer(0.125); var i = 0; while (true) { yield return(clock[i]); if (timer.TimePassed) { i = (i + 1) % clen; timer.Restart(); } } }
void DrawWindow(int windowID) { GUILayout.BeginVertical(); GUILayout.BeginHorizontal(); GUILayout.Label("Search: ", GUILayout.ExpandWidth(false)); var flt = ""; if (load_state != LoadState.LOADING) { flt = GUILayout.TextField(filter, GUILayout.ExpandWidth(true)); } else { GUILayout.Label(filter, GUI.skin.textField, GUILayout.ExpandWidth(true)); } if (!string.IsNullOrEmpty(filter) && GUILayout.Button("X", Styles.danger_button, GUILayout.ExpandWidth(false))) { flt = ""; } if (load_state == LoadState.LOADING) { GUILayout.Label(string.Format("<b>Loading:{0,6:P0}</b>", load_progress), Styles.rich_label, GUILayout.ExpandWidth(false)); } else { GUILayout.Space(0); } GUILayout.EndHorizontal(); var new_filter = flt != filter; if (load_state != LoadState.LOADING && (new_filter || filter_timer.Started)) { if (new_filter) { filter = flt.ToLowerInvariant(); filter_timer.Restart(); } else if (filter_timer.TimePassed) { StartCoroutine(filter_parts()); } } if (parts.Count > 0) { var keys = parts.Keys; AvailablePart toLoad = null; for (int i = page * PAGE_SIZE, stop = Math.Min(i + PAGE_SIZE, parts.Count); i < stop; i++) { var part = keys[i]; GUILayout.BeginHorizontal(); if (GUILayout.Button(parts[part], Styles.boxed_label, GUILayout.ExpandWidth(true))) { toLoad = part; } GUILayout.EndHorizontal(); } if (toLoad != null && load_part != null) { load_part(toLoad); Show(false); } GUILayout.FlexibleSpace(); if (parts.Count > PAGE_SIZE) { select_page(); } if (GUILayout.Button("Close", Styles.close_button, GUILayout.ExpandWidth(true))) { Show(false); } } GUILayout.EndVertical(); TooltipsAndDragWindow(); }