private void OnGUI() { GUILayout.Space(top); GUILayout.BeginHorizontal(); GUILayout.Space(left); GUILayout.BeginVertical(GUILayout.MinWidth(60)); foreach (var grade in grades) { if (GUILayout.Button(grade.info)) { synchronizer.transform.localPosition = grade.adsorb; if (coaxe != null) { coaxe.BreakCoaxe(synchronizer); } coaxe = grade.gear; coaxe.LinkCoaxe(synchronizer); } } if (GUILayout.Button("Default")) { synchronizer.transform.localPosition = defaultPosition; if (coaxe != null) { coaxe.BreakCoaxe(synchronizer); } } GUILayout.EndVertical(); GUILayout.EndHorizontal(); }
/// <summary> /// Break coaxed from power mechanism. /// </summary> public void CoaxeBreak() { if (coaxe != null) { coaxe.BreakCoaxed(this); coaxe = null; } }
/// <summary> /// Coaxe this mechanism to power mechanism. /// </summary> /// <param name="coaxe">Power mechanism.</param> public void CoaxeTo(ICoaxeMechanism coaxe) { if (coaxe == null || coaxe == this.coaxe) { return; } else { CoaxeBreak(); //Coaxe this mechanism to new power mechanism. coaxe.BuildCoaxed(this); this.coaxe = coaxe; } }