void editorFlightControls(FreeFlight ff) { if (ff.enabledGliding = EditorGUILayout.Toggle("Enabled Gliding", ff.enabledGliding)) { ff.maxTurnBank = EditorGUILayout.FloatField("Turn Bank (Degrees)", ff.maxTurnBank); ff.maxPitch = EditorGUILayout.FloatField("Pitch (Degrees)", ff.maxPitch); ff.directionalSensitivity = EditorGUILayout.FloatField("Degrees per Second", ff.directionalSensitivity); } if (ff.enabledFlapping = EditorGUILayout.Toggle("Enabled Flapping", ff.enabledFlapping)) { ff.flapSoundClip = (AudioClip)EditorGUILayout.ObjectField("Flap Sound", ff.flapSoundClip, typeof(AudioClip), false); ff.flapStrength = EditorGUILayout.FloatField("Flap Strength", ff.flapStrength); } if (ff.enabledFlaring = EditorGUILayout.Toggle("Enabled Flaring", ff.enabledFlaring)) { ff.flareAngle = (float)EditorGUILayout.FloatField("Flare Angle", ff.flareAngle); ff.flareSpeed = (float)EditorGUILayout.FloatField("Flare Speed", ff.flareSpeed); ff.flareSoundClip = (AudioClip)EditorGUILayout.ObjectField("Flare Sound", ff.flareSoundClip, typeof(AudioClip), false); } if (ff.enabledDiving = EditorGUILayout.Toggle("Enabled Diving", ff.enabledDiving)) { ff.divingSoundClip = (AudioClip)EditorGUILayout.ObjectField("Dive Sound", ff.divingSoundClip, typeof(AudioClip), false); } if (ff.enabledWindNoise = EditorGUILayout.Toggle("Enabled Wind Noise", ff.enabledWindNoise)) { ff.windNoiseClip = (AudioClip)EditorGUILayout.ObjectField("Wind Sound", ff.windNoiseClip, typeof(AudioClip), false); ff.windNoiseStartSpeed = (float)EditorGUILayout.FloatField("Min Speed Start", ff.windNoiseStartSpeed); ff.windNoiseMaxSpeed = (float)EditorGUILayout.FloatField("Max Speed Stop", ff.windNoiseMaxSpeed); } }
void editorFlightControls(FreeFlight ff) { if (ff.enabledGliding = EditorGUILayout.Toggle ("Enabled Gliding", ff.enabledGliding)) { ff.maxTurnBank = EditorGUILayout.FloatField ("Turn Bank (Degrees)", ff.maxTurnBank); ff.maxPitch = EditorGUILayout.FloatField ("Pitch (Degrees)", ff.maxPitch); ff.directionalSensitivity = EditorGUILayout.FloatField ("Degrees per Second", ff.directionalSensitivity); } if (ff.enabledFlapping = EditorGUILayout.Toggle ("Enabled Flapping", ff.enabledFlapping)) { ff.flapSoundClip = (AudioClip) EditorGUILayout.ObjectField ("Flap Sound", ff.flapSoundClip, typeof(AudioClip), false); ff.flapStrength = EditorGUILayout.FloatField ("Flap Strength", ff.flapStrength); } if (ff.enabledFlaring = EditorGUILayout.Toggle ("Enabled Flaring", ff.enabledFlaring)) { ff.flareAngle = (float) EditorGUILayout.FloatField ("Flare Angle", ff.flareAngle); ff.flareSpeed = (float) EditorGUILayout.FloatField ("Flare Speed", ff.flareSpeed); ff.flareSoundClip = (AudioClip) EditorGUILayout.ObjectField ("Flare Sound", ff.flareSoundClip, typeof(AudioClip), false); } if (ff.enabledDiving = EditorGUILayout.Toggle ("Enabled Diving", ff.enabledDiving)) { ff.divingSoundClip = (AudioClip) EditorGUILayout.ObjectField ("Dive Sound", ff.divingSoundClip, typeof(AudioClip), false); } if (ff.enabledWindNoise = EditorGUILayout.Toggle ("Enabled Wind Noise", ff.enabledWindNoise)) { ff.windNoiseClip = (AudioClip) EditorGUILayout.ObjectField ("Wind Sound", ff.windNoiseClip, typeof(AudioClip), false); ff.windNoiseStartSpeed = (float) EditorGUILayout.FloatField ("Min Speed Start", ff.windNoiseStartSpeed); ff.windNoiseMaxSpeed = (float) EditorGUILayout.FloatField ("Max Speed Stop", ff.windNoiseMaxSpeed); } }
void OnEnable() { if (flightObject == null) { string msg = "Unable to display stat information: No flight object set for " + gameObject.name; msg += " Please set the \'Flight Object\' variable to an object which has the \'FreeFlight\' script attached"; Debug.LogWarning(msg); this.enabled = false; } if (ff == null) { ff = flightObject.GetComponent <FreeFlight>(); } if (ff == null) { string msg = "GameObject '" + flightObject.name + "' doesn't have the 'FreeFlight' script attached. Unable " + "to display flight statistics."; Debug.LogWarning(msg); this.enabled = false; } if (ff != null) { ffp = ff.flightPhysics; } }
public override void OnInspectorGUI() { FreeFlight ff = (FreeFlight)target; FreeFlightPhysics fp = ff.flightPhysics; if (_showFlightControls = EditorGUILayout.Foldout(_showFlightControls, "Flight Controls")) { editorFlightControls(ff); } if (_showGroundControls = EditorGUILayout.Foldout(_showGroundControls, "Ground Controls")) { editorGroundControls(ff); } if (_showTakeoffLanding = EditorGUILayout.Foldout(_showTakeoffLanding, "Takeoff/Landing Controls")) { editorTakeoffLanding(ff); } if (_showPhysics = EditorGUILayout.Foldout(_showPhysics, "Physics")) { editorPhysics(ff, fp); } if (_showProperties = EditorGUILayout.Foldout(_showProperties, "Wing Properties")) { editorWingProperties(fp); } //save the free flight object if the user has made changes if (GUI.changed) { EditorUtility.SetDirty(ff); } }
void editorPhysics(FreeFlight ff, FreeFlightPhysics fp) { ff.state = (FreeFlight.FlightState)EditorGUILayout.EnumPopup("Flight State", ff.state); ff.applyFlightPhysicsOnGround = EditorGUILayout.Toggle("Flight Physics on Ground", ff.applyFlightPhysicsOnGround); fp.liftEnabled = EditorGUILayout.Toggle("Lift", fp.liftEnabled); fp.dragEnabled = EditorGUILayout.Toggle("Drag", fp.dragEnabled); fp.gravityEnabled = EditorGUILayout.Toggle("Gravity", fp.gravityEnabled); }
public override void init(GameObject go, System.Object customPhysics, Inputs inputs) { flightPhysics = (FlightPhysics)customPhysics; base.init (go); soundManager.init (go); mainMonbehaviour = gameObject.GetComponent<FreeFlight> (); setupAnimation (landingAnimation, ref landingHash); setupAnimation (crashingAnimation, ref crashingHash); }
public override void autoConfig() { base.autoConfig (); if (!flightObject) { flightObject = GameObject.FindGameObjectWithTag ("Player"); } nullCheck ("flightObject", flightObject, "Please set it to an object with a Free Flight Component"); ffComponent = flightObject.GetComponent<FreeFlight> (); nullCheck ("", flightObject, "This object can only display stats info for objects with a Free Flight Component."); }
void editorGroundControls(FreeFlight ff) { if (ff.enabledGround = EditorGUILayout.Toggle ("Enabled Ground Locomotion", ff.enabledGround)) { ff.walkingNoiseClip = (AudioClip) EditorGUILayout.ObjectField ("Walking Sound", ff.walkingNoiseClip, typeof(AudioClip), false); ff.groundDrag = EditorGUILayout.FloatField ("Stopping Speed", ff.groundDrag); ff.maxGroundForwardSpeed = (float) EditorGUILayout.FloatField ("Walking Speed", ff.maxGroundForwardSpeed); ff.maxGroundTurningDegreesSecond = (float) EditorGUILayout.FloatField ("Turning Speed", ff.maxGroundTurningDegreesSecond); } if (ff.enabledJumping = EditorGUILayout.Toggle ("Enabled Jumping", ff.enabledJumping)) { ff.jumpingNoiseClip = (AudioClip) EditorGUILayout.ObjectField ("Jumping Sound", ff.jumpingNoiseClip, typeof(AudioClip), false); ff.jumpHeight = (float) EditorGUILayout.FloatField ("Jump Height", ff.jumpHeight); } }
void editorGroundControls(FreeFlight ff) { if (ff.enabledGround = EditorGUILayout.Toggle("Enabled Ground Locomotion", ff.enabledGround)) { ff.walkingNoiseClip = (AudioClip)EditorGUILayout.ObjectField("Walking Sound", ff.walkingNoiseClip, typeof(AudioClip), false); ff.groundDrag = EditorGUILayout.FloatField("Stopping Speed", ff.groundDrag); ff.maxGroundForwardSpeed = (float)EditorGUILayout.FloatField("Walking Speed", ff.maxGroundForwardSpeed); ff.maxGroundTurningDegreesSecond = (float)EditorGUILayout.FloatField("Turning Speed", ff.maxGroundTurningDegreesSecond); } if (ff.enabledJumping = EditorGUILayout.Toggle("Enabled Jumping", ff.enabledJumping)) { ff.jumpingNoiseClip = (AudioClip)EditorGUILayout.ObjectField("Jumping Sound", ff.jumpingNoiseClip, typeof(AudioClip), false); ff.jumpHeight = (float)EditorGUILayout.FloatField("Jump Height", ff.jumpHeight); } }
// Use this for initialization void Awake() { if (!cam) cam = GameObject.FindGameObjectWithTag ("MainCamera"); if (!target) target = GameObject.FindGameObjectWithTag ("Player"); //If we can't find the player by tag, assume we're already attached to the flight object. if (!target) { target = gameObject; } ff = target.GetComponent<FreeFlight> (); if (!ff) { Debug.LogError (gameObject + ": Flight Camera: This script was designed to work with free flight objects, please set the 'target' to one."); this.enabled = false; } }
public override void autoConfig() { base.autoConfig (); if (!flightObject) { flightObject = GameObject.FindGameObjectWithTag ("Player"); } nullCheck ("flightObject", flightObject, "Please set it to an object with a Free Flight Component"); ffComponent = flightObject.GetComponent<FreeFlight> (); frigidbody = flightObject.GetComponent<Rigidbody> (); nullCheck ("Free Flight Component", ffComponent, "Please add a Free Flight component in order to show physics stats"); fPhysics = ffComponent.modeManager.flightMode.flightModePhysics; }
// Use this for initialization void Start() { if (!playerObject) { playerObject = GameObject.FindGameObjectWithTag("Player"); } if (playerObject != null) { ff = playerObject.GetComponentInChildren <FreeFlight>(); } else { string msg = "The player object is not set for the in-game menu. " + "Please set the 'player object' in the 'pause menu' to whatever object is controlled by the player."; throw new UnityException(msg); } }
void OnEnable() { if (flightObject == null) { string msg = "Unable to display stat information: No flight object set for " + gameObject.name; msg += " Please set the \'Flight Object\' variable to an object which has the \'FreeFlight\' script attached"; Debug.LogWarning (msg); this.enabled = false; } if (ff == null) ff = flightObject.GetComponent<FreeFlight>(); if (ff == null) { string msg = "GameObject '"+ flightObject.name + "' doesn't have the 'FreeFlight' script attached. Unable " + "to display flight statistics."; Debug.LogWarning (msg); this.enabled = false; } if (ff != null) ffp = ff.flightPhysics; }
// Use this for initialization void Awake() { if (!cam) { cam = GameObject.FindGameObjectWithTag("MainCamera"); } if (!target) { target = GameObject.FindGameObjectWithTag("Player"); } //If we can't find the player by tag, assume we're already attached to the flight object. if (!target) { target = gameObject; } ff = target.GetComponent <FreeFlight> (); if (!ff) { Debug.LogError(gameObject + ": Flight Camera: This script was designed to work with free flight objects, please set the 'target' to one."); this.enabled = false; } }
void editorTakeoffLanding(FreeFlight ff) { if (ff.enabledTakeoff = EditorGUILayout.Toggle("Enabled Takeoff", ff.enabledTakeoff)) { ff.takeoffSoundClip = (AudioClip)EditorGUILayout.ObjectField("Takeoff Sound", ff.takeoffSoundClip, typeof(AudioClip), false); } if (ff.enabledLaunchIfAirborn = EditorGUILayout.Toggle("Auto-Takeoff If Airborn", ff.enabledLaunchIfAirborn)) { ff.minHeightToLaunchIfAirborn = EditorGUILayout.FloatField("Min Height", ff.minHeightToLaunchIfAirborn); } if (ff.enabledLanding = EditorGUILayout.Toggle("Enabled Landing", ff.enabledLanding)) { ff.landingSoundClip = (AudioClip)EditorGUILayout.ObjectField("Landing Sound", ff.landingSoundClip, typeof(AudioClip), false); ff.standUpSpeed = (float)EditorGUILayout.FloatField("Stand Up Speed", ff.standUpSpeed); ff.maxStandUpTime = (float)EditorGUILayout.FloatField("Stand Up Time", ff.maxStandUpTime); } if (ff.enabledCrashing = EditorGUILayout.Toggle("Enabled Crashing", ff.enabledCrashing)) { ff.crashSoundClip = (AudioClip)EditorGUILayout.ObjectField("Dive Sound", ff.crashSoundClip, typeof(AudioClip), false); ff.crashSpeed = (float)EditorGUILayout.FloatField("Crash Speed", ff.crashSpeed); } }
// Use this for initialization void Start() { if (!playerObject) playerObject = GameObject.FindGameObjectWithTag("Player"); if (playerObject != null) { ff = playerObject.GetComponentInChildren<FreeFlight>(); } else { string msg = "The player object is not set for the in-game menu. " + "Please set the 'player object' in the 'pause menu' to whatever object is controlled by the player."; throw new UnityException (msg); } }
void editorPhysics(FreeFlight ff, FreeFlightPhysics fp) { ff.state = (FreeFlight.FlightState) EditorGUILayout.EnumPopup("Flight State", ff.state); ff.applyFlightPhysicsOnGround = EditorGUILayout.Toggle ("Flight Physics on Ground", ff.applyFlightPhysicsOnGround); fp.liftEnabled = EditorGUILayout.Toggle ("Lift", fp.liftEnabled); fp.dragEnabled = EditorGUILayout.Toggle ("Drag", fp.dragEnabled); fp.gravityEnabled = EditorGUILayout.Toggle ("Gravity", fp.gravityEnabled); }
void editorTakeoffLanding(FreeFlight ff) { if (ff.enabledTakeoff = EditorGUILayout.Toggle ("Enabled Takeoff", ff.enabledTakeoff)) { ff.takeoffSoundClip = (AudioClip) EditorGUILayout.ObjectField ("Takeoff Sound", ff.takeoffSoundClip, typeof(AudioClip), false); } if (ff.enabledLaunchIfAirborn = EditorGUILayout.Toggle ("Auto-Takeoff If Airborn", ff.enabledLaunchIfAirborn)) { ff.minHeightToLaunchIfAirborn = EditorGUILayout.FloatField ("Min Height", ff.minHeightToLaunchIfAirborn); } if (ff.enabledLanding = EditorGUILayout.Toggle ("Enabled Landing", ff.enabledLanding)) { ff.landingSoundClip = (AudioClip) EditorGUILayout.ObjectField ("Landing Sound", ff.landingSoundClip, typeof(AudioClip), false); ff.standUpSpeed = (float) EditorGUILayout.FloatField ("Stand Up Speed", ff.standUpSpeed); ff.maxStandUpTime = (float) EditorGUILayout.FloatField ("Stand Up Time", ff.maxStandUpTime); } if (ff.enabledCrashing = EditorGUILayout.Toggle ("Enabled Crashing", ff.enabledCrashing)) { ff.crashSoundClip = (AudioClip) EditorGUILayout.ObjectField ("Dive Sound", ff.crashSoundClip, typeof(AudioClip), false); ff.crashSpeed = (float) EditorGUILayout.FloatField ("Crash Speed", ff.crashSpeed); } }