/// <summary> /// Hardcoded. /// Setting CanvasUI Text for profile type. /// By pressing alpha number keys 1,2 or 3 switching between profiles and updating values on drone it self... /// </summary> void DrawProfileText() { if (dms._profileIndex == 0) { SetTextAndFont("Advanced", 60); } else if (dms._profileIndex == 1) { SetTextAndFont("Intermediate", 60); } else if (dms._profileIndex == 2) { SetTextAndFont("Beginner", 60); } if (Input.GetKeyDown(KeyCode.Alpha1)) { SetTextAndFont("Advanced", 60); dms._profileIndex = 0; dms.UpdateValuesFromEditor(); } else if (Input.GetKeyDown(KeyCode.Alpha2)) { SetTextAndFont("Intermediate", 60); dms._profileIndex = 1; dms.UpdateValuesFromEditor(); } else if (Input.GetKeyDown(KeyCode.Alpha3)) { SetTextAndFont("Beginner", 60); dms._profileIndex = 2; dms.UpdateValuesFromEditor(); } }
void DrawCustomProfilesWindow(DroneMovementScript myScript) { EditorGUILayout.BeginVertical("Box"); EditorGUILayout.LabelField("Use this tab bar to customize flying settings. \n Edit to your own preferences. \n Selected one is applied to the drone and will drive with those settings.", EditorStyles.helpBox); if (demo) { GUI.enabled = false; myScript._profileIndex = 1; } else { GUI.enabled = true; } myScript._profileIndex = GUILayout.Toolbar(myScript._profileIndex, new string[] { "Advanced", "Intermediate", "Begginer" }); switch (myScript._profileIndex) { default: EditorGUILayout.LabelField("Velocity Limiter", EditorStyles.toolbarButton); EditorGUILayout.Space(); myScript.profiles[myScript._profileIndex].maxSpeed = EditorGUILayout.FloatField(new GUIContent("Max Speed (km/h)", "todo..."), myScript.profiles[myScript._profileIndex].maxSpeed); EditorGUILayout.Space(); EditorGUILayout.Space(); myScript.profiles[myScript._profileIndex].minDrag = EditorGUILayout.Slider(new GUIContent("Minimum Drag Value", "todo..."), myScript.profiles[myScript._profileIndex].minDrag, 0.0f, 0.05f); myScript.profiles[myScript._profileIndex].maxDrag = EditorGUILayout.Slider(new GUIContent("Maximum Drag Value", "todo..."), myScript.profiles[myScript._profileIndex].maxDrag, 0.05f, 4.0f); myScript.profiles[myScript._profileIndex].speedValueCurve = EditorGUILayout.CurveField(new GUIContent("Drag/Speed Value Curve", "todo..."), myScript.profiles[myScript._profileIndex].speedValueCurve); EditorGUILayout.Space(); EditorGUILayout.LabelField("Angulr Drag Settings", EditorStyles.toolbarButton); EditorGUILayout.Space(); myScript.profiles[myScript._profileIndex].maxAngularDrag = EditorGUILayout.FloatField(new GUIContent("Max Angular Drag", "todo..."), myScript.profiles[myScript._profileIndex].maxAngularDrag); myScript.profiles[myScript._profileIndex].minAngularDrag = EditorGUILayout.FloatField(new GUIContent("Min Angular Drag", "todo..."), myScript.profiles[myScript._profileIndex].minAngularDrag); myScript.profiles[myScript._profileIndex].angularDragZeroingTime = EditorGUILayout.FloatField(new GUIContent("Zeroing Time", "todo..."), myScript.profiles[myScript._profileIndex].angularDragZeroingTime); EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.LabelField("Feature Speeds", EditorStyles.toolbarButton); EditorGUILayout.Space(); if (!demo) { GUI.enabled = false; } EditorGUILayout.Slider(new GUIContent("Throttle", "todo..."), myScript.currentThrottle, 0.0f, 1.0f); if (!demo) { GUI.enabled = true; } myScript.profiles[myScript._profileIndex].inputThrottleCurve = EditorGUILayout.CurveField(new GUIContent("Throttle Curve", "todo..."), myScript.profiles[myScript._profileIndex].inputThrottleCurve); if (!demo) { GUI.enabled = false; } EditorGUILayout.Slider(new GUIContent("Pitch", "todo..."), myScript.currentPitchThrottle, -1.0f, 1.0f); if (!demo) { GUI.enabled = true; } myScript.profiles[myScript._profileIndex].inputPitchThrottleCurve = EditorGUILayout.CurveField(new GUIContent("Pitch Curve", "todo..."), myScript.profiles[myScript._profileIndex].inputPitchThrottleCurve); if (!demo) { GUI.enabled = false; } EditorGUILayout.Slider(new GUIContent("Roll", "todo..."), myScript.currentRollThrottle, -1.0f, 1.0f); if (!demo) { GUI.enabled = true; } myScript.profiles[myScript._profileIndex].inputRollThrottleCurve = EditorGUILayout.CurveField(new GUIContent("Roll Curve", "todo..."), myScript.profiles[myScript._profileIndex].inputRollThrottleCurve); if (!demo) { GUI.enabled = false; } EditorGUILayout.Slider(new GUIContent("Yaw", "todo..."), myScript.currentYawThrottle, -1.0f, 1.0f); if (!demo) { GUI.enabled = true; } myScript.profiles[myScript._profileIndex].inputYawThrottleCurve = EditorGUILayout.CurveField(new GUIContent("Yaw Curve", "todo..."), myScript.profiles[myScript._profileIndex].inputYawThrottleCurve); EditorGUILayout.Space(); EditorGUILayout.Space(); myScript.profiles[myScript._profileIndex].maxThrottleForce = EditorGUILayout.FloatField(new GUIContent("Max Throttle Force", "todo..."), myScript.profiles[myScript._profileIndex].maxThrottleForce); myScript.profiles[myScript._profileIndex].maxPitchForce = EditorGUILayout.FloatField(new GUIContent("Max Pitch Force", "todo......"), myScript.profiles[myScript._profileIndex].maxPitchForce); myScript.profiles[myScript._profileIndex].maxRollForce = EditorGUILayout.FloatField(new GUIContent("Max Roll Force", "todo......"), myScript.profiles[myScript._profileIndex].maxRollForce); myScript.profiles[myScript._profileIndex].maxRotateForce = EditorGUILayout.FloatField(new GUIContent("Max Yaw Force", "todo......"), myScript.profiles[myScript._profileIndex].maxRotateForce); EditorGUILayout.Space(); myScript.profiles[myScript._profileIndex].rotationSlowDown = EditorGUILayout.Slider(new GUIContent("Rotation Slowdown", "todo......"), myScript.profiles[myScript._profileIndex].rotationSlowDown, 0.0f, 15.0f); EditorGUILayout.Space(); EditorGUILayout.BeginVertical("Box"); myScript.profiles[myScript._profileIndex].angleLocked = EditorGUILayout.Toggle(new GUIContent("Angle Lock", "todo......"), myScript.profiles[myScript._profileIndex].angleLocked); myScript.profiles[myScript._profileIndex].angleLimit = EditorGUILayout.FloatField(new GUIContent("Max Angle Tilt", "todo......"), myScript.profiles[myScript._profileIndex].angleLimit); EditorGUILayout.EndVertical(); EditorGUILayout.Space(); EditorGUILayout.LabelField("Drone Sound Amplifier", EditorStyles.toolbarButton); EditorGUILayout.BeginVertical("Box"); EditorGUILayout.HelpBox("Main brush sound, pitch and volume amplifiers", MessageType.Info); myScript.profiles[myScript._profileIndex].dronePitchAmplifier = EditorGUILayout.Slider(new GUIContent("Drone Pitch Change", "tooltiptodo..."), myScript.profiles[myScript._profileIndex].dronePitchAmplifier, 0.0f, 2.0f); myScript.profiles[myScript._profileIndex].soundMultiplier = EditorGUILayout.Slider(new GUIContent("Drone Movement Sound Change", "tooltiptodo..."), myScript.profiles[myScript._profileIndex].soundMultiplier, 0.0f, 2.0f); EditorGUILayout.HelpBox("Angular sound, volume amplifier", MessageType.Info); myScript.profiles[myScript._profileIndex].angularSoundMultiplier = EditorGUILayout.Slider(new GUIContent("Drone Angular Volume Change", "tooltiptodo..."), myScript.profiles[myScript._profileIndex].angularSoundMultiplier, 0.0f, 2.0f); EditorGUILayout.HelpBox("Static sound, volume amplifier", MessageType.Info); myScript.profiles[myScript._profileIndex].staticSoundMultiplier = EditorGUILayout.Slider(new GUIContent("Static Volume Change", "tooltiptodo..."), myScript.profiles[myScript._profileIndex].staticSoundMultiplier, 0.0f, 2.0f); myScript.profiles[myScript._profileIndex].staticSoundStartPos = EditorGUILayout.Slider(new GUIContent("Static Staring Volume", "tooltiptodo..."), myScript.profiles[myScript._profileIndex].staticSoundStartPos, 0.0f, 2.0f); EditorGUILayout.EndVertical(); //applying presets myScript.UpdateValuesFromEditor(); //myScript.maxSpeed = myScript.profiles[myScript._profileIndex].maxSpeed; //myScript.maxThrottleForce = myScript.profiles[myScript._profileIndex].maxThrottleForce; //myScript.maxRollForce = myScript.profiles[myScript._profileIndex].maxRollForce; //myScript.maxPitchForce = myScript.profiles[myScript._profileIndex].maxPitchForce; //myScript.maxRotateForce = myScript.profiles[myScript._profileIndex].maxRotateForce; //myScript.angleLocked = myScript.profiles[myScript._profileIndex].angleLocked; //myScript.angleLimit = myScript.profiles[myScript._profileIndex].angleLimit; //myScript.dronePitchAmplifier = myScript.profiles[myScript._profileIndex].dronePitchAmplifier; //myScript.soundMultiplier = myScript.profiles[myScript._profileIndex].soundMultiplier; //myScript.angularSoundMultiplier = myScript.profiles[myScript._profileIndex].angularSoundMultiplier; //myScript.staticSoundMultiplier = myScript.profiles[myScript._profileIndex].staticSoundMultiplier; //myScript.staticSoundStartPos = myScript.profiles[myScript._profileIndex].staticSoundStartPos; break; } EditorGUILayout.EndVertical(); if (demo) { GUI.enabled = true; } }