public override void OnInspectorGUI() { GUI.changed = false; ManeuverRenderer mr = (ManeuverRenderer)target; GameObject prefab = mr.maneuverArrowPrefab; float lineLen = mr.lineLengthScale; float lineWidth = mr.lineWidthScale; float coneScale = mr.coneScale; prefab = (GameObject)EditorGUILayout.ObjectField( new GUIContent("Maneuver Arrow Prefab", pfTip), prefab, typeof(GameObject), true); lineLen = EditorGUILayout.FloatField(new GUIContent("Line Length scale", lenTip), lineLen); lineWidth = EditorGUILayout.FloatField(new GUIContent("Line Width scale", widthTip), lineWidth); coneScale = EditorGUILayout.FloatField(new GUIContent("Arrow head scale", coneTip), coneScale); if (GUI.changed) { Undo.RecordObject(mr, "OrbitEllipse Change"); mr.maneuverArrowPrefab = prefab; mr.lineLengthScale = lineLen; mr.lineWidthScale = lineWidth; mr.coneScale = coneScale; EditorUtility.SetDirty(mr); } }
// Use this for initialization void Start() { keyCodes = new KeyForMove[] { new KeyForMove(KeyCode.A, new Vector3(-1, 0, 0)), new KeyForMove(KeyCode.D, new Vector3(1, 0, 0)), new KeyForMove(KeyCode.W, new Vector3(0, 1, 0)), new KeyForMove(KeyCode.S, new Vector3(0, -1, 0)), new KeyForMove(KeyCode.Q, new Vector3(0, 0, 1)), new KeyForMove(KeyCode.E, new Vector3(0, 0, -1)), }; // disable maneuver predictor until things settle (can get Invalid local AABB otherwise) maneuverOrbitPredictor.gameObject.SetActive(false); maneuverSegment.gameObject.SetActive(false); // is there a maneuver renderer? maneuverRenderer = GetComponent <ManeuverRenderer>(); }
// Use this for initialization void Start() { ge = GravityEngine.Instance(); // Scan ellipses in scene and gather into data structure OrbitEllipse[] ellipses = (OrbitEllipse[])Object.FindObjectsOfType(typeof(OrbitEllipse)); targetEllipses = new TargetEllipse[ellipses.Length]; int i = 0; foreach (OrbitEllipse ellipse in ellipses) { // skip spaceship ellipse (not a target) if (ellipse.gameObject != spaceshipNBody.gameObject) { targetEllipses[i].ellipse = ellipse; targetEllipses[i].lineRenderer = ellipse.GetComponentInChildren <LineRenderer>(); targetEllipses[i].originalMaterial = targetEllipses[i].lineRenderer.material; // create a maneuver symbol, set inactive for now. targetEllipses[i].maneuverSymbol = Instantiate <GameObject>(maneuverSymbolPrefab); targetEllipses[i].maneuverSymbol.SetActive(false); // make it a child of controller (keep things tidy) targetEllipses[i].maneuverSymbol.transform.parent = transform; targetEllipses[i].manueverPhase = 0; i++; } } SelectEllipse(0); AddConsoleCommands(); InitHelpText(); instructions.gameObject.SetActive(false); // disable maneuver predictor until things settle (can get Invalid local AABB otherwise) maneuverOrbitPredictor.gameObject.SetActive(false); maneuverSegment.gameObject.SetActive(false); // is there a maneuver renderer? maneuverRenderer = GetComponent <ManeuverRenderer>(); }