/// <summary> /// Called when the trigger ends /// </summary> /// <param name="poi"></param> public override void OnEnd(PegasusPoi poi) { if (poi == null) { Debug.LogWarning(string.Format("Poi was not supplied on {0} - exiting", name)); return; } if (m_targetAnimation == null) { Debug.LogWarning(string.Format("Animation was not supplied on {0} - exiting", name)); return; } if (m_triggerAtEnd) { if (m_actionOnStart == PegasusConstants.PoiAnimationTriggerAction.PlayAnimation) { m_targetAnimation.Play(m_animations[m_startAnimationIdx].name); } else if (m_actionOnStart == PegasusConstants.PoiAnimationTriggerAction.StopAnimation) { m_targetAnimation.Stop(); } } }
public float m_weatherTransitionTime = 10f; //Seconds /// <summary> /// Called when the trigger starts /// </summary> /// <param name="poi"></param> public override void OnStart(PegasusPoi poi) { if (poi == null) { Debug.LogWarning(string.Format("Poi was not supplied on {0} - exiting", name)); return; } if (m_enviroSky == null) { m_enviroSky = GameObject.FindObjectOfType <EnviroSkyMgr>(); } if (m_enviroSky == null) { Debug.LogWarning(string.Format("EnviroSky Manager was not located on {0} - exiting", name)); return; } if (m_controlTime) { m_enviroSky.SetTimeOfDay(m_startTime); } if (m_controlWeather) { m_enviroSky.EnviroWeatherSettings.effectTransitionSpeed = m_weatherTransitionTime; m_enviroSky.ChangeWeather(m_weatherID); } }
/// <summary> /// Called when the trigger ends /// </summary> /// <param name="poi"></param> public virtual void OnEnd(PegasusPoi poi) { if (poi != null && m_triggerAtEnd) { if (poi.m_manager.m_displayDebug == true) { Debug.Log(string.Format("Ended trigger on {0} - {1}", poi.m_manager.name, poi.name)); } } }
/// <summary> /// Called when the trigger is updated /// </summary> /// <param name="poi"></param> public virtual void OnUpdate(PegasusPoi poi, float progress) { if (poi != null && m_triggerOnUpdate) { if (poi.m_manager.m_displayDebug == true) { Debug.Log(string.Format("Udpated trigger on {0} - {1} {2:0.00}", poi.m_manager.name, poi.name, progress)); } } }
/// <summary> /// Return true if the other object is the same as this one /// </summary> /// <param name="poi">The other object to check</param> /// <returns></returns> public bool IsSameObject(PegasusPoi poi) { if (poi == null) { return(false); } if (this.GetInstanceID() == poi.GetInstanceID()) { return(true); } return(false); }
/// <summary> /// Called when the trigger is updated /// </summary> /// <param name="poi"></param> public override void OnUpdate(PegasusPoi poi, float progress) { if (m_enviroSky == null) { return; } if (m_controlTime) { m_enviroSky.SetTimeOfDay(m_startTime + ((m_endTime - m_startTime) * progress)); } }
/// <summary> /// Called when the trigger is updated /// </summary> /// <param name="poi"></param> public override void OnUpdate(PegasusPoi poi, float progress) { if ((poi != null) && (m_actionOnEnd != PegasusConstants.PoiHeliosTriggerAction.DoNothing)) { if ((m_endProcessStarted != true) && ((Time.time * 1000f) >= m_endTimeStartMS)) { m_endProcessStarted = true; if (m_actionOnEnd == PegasusConstants.PoiHeliosTriggerAction.FadeIn) { StartCoroutine(FadeIn(m_endColour, m_endDuration)); } else if (m_actionOnEnd == PegasusConstants.PoiHeliosTriggerAction.FadeOut) { StartCoroutine(FadeOut(m_endColour, m_endDuration)); } } } }
/// <summary> /// Called when the trigger starts /// </summary> /// <param name="poi"></param> public override void OnStart(PegasusPoi poi) { if (poi == null) { Debug.LogWarning(string.Format("Poi was not supplied on {0} - exiting", name)); return; } if (m_heliosUtility == null) { m_heliosUtility = GameObject.FindObjectOfType <HeliosUtility>(); } if (m_heliosUtility == null) { Debug.LogWarning(string.Format("Helios was not located on {0} - exiting", name)); return; } if (m_triggerAtStart) { if (m_actionOnStart == PegasusConstants.PoiHeliosTriggerAction.FadeIn) { StartCoroutine(FadeIn(m_startColour, m_startDuration)); } else if (m_actionOnStart == PegasusConstants.PoiHeliosTriggerAction.FadeOut) { StartCoroutine(FadeOut(m_startColour, m_startDuration)); } } //Set up when the end fade starts - work it backwards from the segment time if (m_triggerAtEnd && m_actionOnEnd != PegasusConstants.PoiHeliosTriggerAction.DoNothing) { //Calculate when end start time should kick in m_endProcessStarted = false; m_endTimeStartMS = (float)poi.m_segmentDuration.TotalMilliseconds; if (m_endTimeStartMS > (m_endDuration * 1000f)) { m_endTimeStartMS = m_endDuration * 1000f; } m_endTimeStartMS = Time.time + (float)poi.m_segmentDuration.TotalMilliseconds - m_endTimeStartMS; } }
/// <summary> /// This is called when we select the poi in the editor /// </summary> private void OnEnable() { if (target == null) { return; } //Get the control id m_editor_control_id = GUIUtility.GetControlID(this.GetHashCode(), FocusType.Passive); //Get our poi m_poi = (PegasusPoi)target; //And select us if (m_poi != null) { m_poi.m_manager.SelectPoi(m_poi); m_poi.m_manager.MoveTargetToPoi(m_poi); } }
//TODO: Create an editor that only shows the appropriate variable value field public override void OnStart(PegasusPoi poi) { // TODO: convert string name to an animation ID for performance reasons switch (m_variableType) { case AnimationVariableType.Float: m_animator.SetFloat(m_variableName, m_floatValue); break; case AnimationVariableType.Int: m_animator.SetInteger(m_variableName, m_intValue); break; case AnimationVariableType.Bool: m_animator.SetBool(m_variableName, m_boolValue); break; case AnimationVariableType.Trigger: m_animator.SetTrigger(m_variableName); break; } }
/// <summary> /// Draw the POI gui /// </summary> public override void OnInspectorGUI() { //Get our trigger m_trigger = (TriggerControlAnimation)target; //Set up the box style if (m_boxStyle == null) { m_boxStyle = new GUIStyle(GUI.skin.box); m_boxStyle.normal.textColor = GUI.skin.label.normal.textColor; m_boxStyle.fontStyle = FontStyle.Bold; m_boxStyle.alignment = TextAnchor.UpperLeft; } //Setup the wrap style if (m_wrapStyle == null) { m_wrapStyle = new GUIStyle(GUI.skin.label); m_wrapStyle.wordWrap = true; } //Create a nice text intro GUILayout.BeginVertical("Pegasus Animation Trigger", m_boxStyle); GUILayout.Space(20); EditorGUILayout.LabelField("This trigger controls animations.", m_wrapStyle); GUILayout.EndVertical(); EditorGUI.BeginChangeCheck(); GUILayout.Space(5); //See if we can grab the animation off the manager target object if there is no animation if (m_trigger.m_targetAnimation == null) { PegasusPoi poi = m_trigger.gameObject.GetComponentInChildren <PegasusPoi>(); if (poi != null) { if (poi.m_manager.m_target != null) { m_trigger.m_targetAnimation = poi.m_manager.m_target.GetComponentInChildren <Animation>(); } } } //As Animation targetAnimation = (Animation)EditorGUILayout.ObjectField(GetLabel("Target"), m_trigger.m_targetAnimation, typeof(Animation), true); PegasusConstants.PoiAnimationTriggerAction actionOnStart = m_trigger.m_actionOnStart; int startAnimationIdx = m_trigger.m_startAnimationIdx; PegasusConstants.PoiAnimationTriggerAction actionOnEnd = m_trigger.m_actionOnEnd; if (targetAnimation != null) { actionOnStart = (PegasusConstants.PoiAnimationTriggerAction)EditorGUILayout.EnumPopup(GetLabel("Action On Start"), actionOnStart); if (actionOnStart == PegasusConstants.PoiAnimationTriggerAction.PlayAnimation) { int assetIdx = 0; GUIContent[] assetChoices = null; assetChoices = new GUIContent[targetAnimation.GetClipCount()]; foreach (AnimationState anim in targetAnimation) { assetChoices[assetIdx++] = new GUIContent(anim.name); } startAnimationIdx = EditorGUILayout.Popup(GetLabel("Animation"), startAnimationIdx, assetChoices); } actionOnEnd = (PegasusConstants.PoiAnimationTriggerAction)EditorGUILayout.EnumPopup(GetLabel("Action On End"), actionOnEnd); } /* * GUILayout.BeginVertical("Target Lookat", m_boxStyle); * GUILayout.Space(20); * PegasusConstants.LookatType lookatType = (PegasusConstants.LookatType)EditorGUILayout.EnumPopup(GetLabel("Target"), m_poi.m_lookatType); * float lookAtAngle = m_poi.m_lookAtAngle; * float lookAtDistance = m_poi.m_lookAtDistance; * float lookAtHeight = m_poi.m_lookAtHeight; * if (lookatType == PegasusConstants.LookatType.Path) * { * GUI.enabled = false; * } * lookAtAngle = EditorGUILayout.Slider(GetLabel(" Angle"), m_poi.m_lookAtAngle, 0f, 359.9f); * lookAtDistance = EditorGUILayout.FloatField(GetLabel(" Distance"), m_poi.m_lookAtDistance); * lookAtHeight = EditorGUILayout.FloatField(GetLabel(" Height"), m_poi.m_lookAtHeight); * GUI.enabled = true; * GUILayout.Space(3); * GUILayout.EndVertical(); */ GUILayout.Space(5); //Check for changes, make undo record, make changes and let editor know we are dirty if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(m_trigger, "Made trigger changes"); m_trigger.m_triggerAtStart = true; m_trigger.m_triggerOnUpdate = false; m_trigger.m_triggerAtEnd = true; m_trigger.m_targetAnimation = targetAnimation; m_trigger.m_actionOnStart = actionOnStart; m_trigger.m_startAnimationIdx = startAnimationIdx; m_trigger.m_actionOnEnd = actionOnEnd; //Mark it as dirty EditorUtility.SetDirty(m_trigger); } }
/// <summary> /// Draw the gizmos /// </summary> /// <param name="isSelected"></param> private void DrawGizmos(bool isSelected) { //Determine whether to drop out if (!isSelected && !m_alwaysShowGizmos) { return; } //Check to see if we have a change in the state of our list - force an initialise if so if (transform.parent.childCount != m_manager.m_poiList.Count) { m_manager.InitialiseFlythrough(); } #if UNITY_EDITOR //Make a check to see if we are selected - disable if not if (Selection.activeGameObject != null && Selection.activeGameObject.GetInstanceID() != this.gameObject.GetInstanceID()) { m_isSelected = false; } #endif //Now draw the gizmos //Segment path spline float velRange = PegasusConstants.SpeedReallyFast - PegasusConstants.SpeedReallySlow; if (m_nextPoi != null) { //See if we need to draw the segments for this bool drawSegments = true; if (m_isLastPOI && m_manager.m_flythroughType == PegasusConstants.FlythroughType.SingleShot) { drawSegments = false; } if (drawSegments) { float inc = 0.05f; float vel1, vel2; Vector3 pos1, pos2; pos1 = CalculatePositionSpline(0f); vel1 = CalculateVelocity(0f); for (float pct = inc; pct <= 1.02f; pct += inc) { //pos2 = CalculatePositionSpline(pct); pos2 = CalculatePositionLinear(pct); vel2 = CalculateVelocity(pct); if (m_isSelected) { Gizmos.color = Color.magenta * Color.Lerp(Color.cyan, Color.red, ((vel1 + vel2 / 2f) - PegasusConstants.SpeedReallySlow) / velRange); } else { Gizmos.color = Color.Lerp(Color.cyan, Color.red, ((vel1 + vel2 / 2f) - PegasusConstants.SpeedReallySlow) / velRange); } Gizmos.DrawLine(pos1, pos2); vel1 = vel2; pos1 = pos2; } } } /* * Vector3 point1 = m_poiList[segment + 1].m_targetLocation; * * Vector3 point2 = m_poiList[segment + 2].m_targetLocation; * * Vector3 tangent2 = m_poiList[segment + 3].m_targetLocation; * * Vector3 t2 = Vector3.Normalize(m_poiList[segment + 2].m_targetLocation - m_poiList[segment + 3].m_targetLocation) * smooth; * * Gizmos.color = Color.magenta; * Gizmos.DrawLine(m_poiList[segment + 2].m_targetLocation, m_poiList[segment + 2].m_targetLocation + t2); * * * tangent2 = m_poiList[segment + 2].m_targetLocation + t2; * * Gizmos.color = Color.green; * * for (int i = 0; i < 30; i++) * { * Gizmos.DrawLine(Hermite(point1, tangent1, point2, tangent2, (float) i/40f), * Hermite(point1, tangent1, point2, tangent2, (float)(i + 1)/40f)); * } */ //Only dray this in correct scenario if (m_lookatType == PegasusConstants.LookatType.Target) { //Line to lookat location Gizmos.color = Color.Lerp(Color.cyan, Color.red, (m_startSpeed - PegasusConstants.SpeedReallySlow) / velRange); Gizmos.DrawLine(transform.position, m_lookatLocation); //Lookat sphere Gizmos.color = Color.cyan; Gizmos.DrawSphere(m_lookatLocation, 0.25f); } //Are we last one, and is play next chosen Gizmos.color = Color.yellow; if (m_isLastPOI == true && m_manager.m_flythroughType == PegasusConstants.FlythroughType.SingleShot && m_manager.m_flythroughEndAction == PegasusConstants.FlythroughEndAction.PlayNextPegasus && m_manager.m_nextPegasus != null) { PegasusPoi nextPoi = m_manager.m_nextPegasus.GetFirstPOI(); if (nextPoi != null) { Gizmos.DrawLine(transform.position, nextPoi.transform.position); } } //Flythrough location Gizmos.DrawSphere(transform.position, m_manager.m_poiGizmoSize); }
void OnSceneGUI() { //Exit if we dont have an event if (Event.current == null) { return; } //Exit if we dont have poi or manager if (m_poi == null || m_poi.m_manager == null) { return; } //Check for and handle attempts to push transform under ground - this is generally accidental if (m_poi.transform.hasChanged) { Undo.RecordObject(m_poi, "Made changes"); //The rotation was changed if (m_poi.transform.localEulerAngles != m_poi.m_lastRotation) { m_poi.m_autoRollOn = false; m_poi.m_lastRotation = m_poi.transform.localEulerAngles; } m_poi.transform.position = m_poi.m_manager.GetValidatedPoiPosition(m_poi.transform.position, m_poi.m_heightCheckType); m_poi.GetRelativeOffsets(m_poi.transform.position, m_poi.m_lookatLocation, out m_poi.m_lookAtDistance, out m_poi.m_lookAtHeight, out m_poi.m_lookAtAngle); m_poi.m_manager.UpdateSegmentWithDependencies(m_poi); m_poi.m_manager.MoveTargetToPoi(m_poi); m_poi.transform.hasChanged = false; EditorUtility.SetDirty(m_poi); return; } //Now handle manual lookat location changes if (m_poi.m_lookatType == PegasusConstants.LookatType.Target) { Vector3 lookAtLocation = m_poi.m_manager.GetValidatedLookatPosition(Handles.DoPositionHandle(m_poi.m_lookatLocation, Quaternion.identity), m_poi.m_heightCheckType); if (lookAtLocation != m_poi.m_lookatLocation) { Undo.RecordObject(m_poi, "Made changes"); m_poi.m_lookatLocation = lookAtLocation; m_poi.m_lookatType = PegasusConstants.LookatType.Target; m_poi.GetRelativeOffsets(m_poi.transform.position, m_poi.m_lookatLocation, out m_poi.m_lookAtDistance, out m_poi.m_lookAtHeight, out m_poi.m_lookAtAngle); m_poi.m_manager.UpdateSegmentWithDependencies(m_poi); m_poi.m_manager.MoveTargetToPoi(m_poi); EditorUtility.SetDirty(m_poi); return; } } //Ignore layout and repaint events //if (Event.current.type == EventType.Layout || Event.current.type == EventType.Repaint) //{ // return; //} //Make sure we have defaults for key presses if (m_poi.m_manager.m_defaults == null) { m_poi.m_manager.m_defaults = PegasusManagerEditor.GetDefaults(); } //Keyboard events if (Event.current.control == true && Event.current.type == EventType.KeyDown) { //Up key if (Event.current.keyCode == m_poi.m_manager.m_defaults.m_keyUp) { GUIUtility.hotControl = m_editor_control_id; //Plain control is the POI if (Event.current.shift != true) { m_poi.m_manager.MovePoi(m_poi, Vector3.up * 0.5f); } else //Shift is the POI target { m_poi.m_manager.MovePoiLookat(m_poi, Vector3.up * 0.5f); } m_poi.m_manager.MoveTargetToPoi(m_poi); EditorUtility.SetDirty(m_poi); Event.current.Use(); GUIUtility.hotControl = 0; return; } //Down key if (Event.current.keyCode == m_poi.m_manager.m_defaults.m_keyDown) { GUIUtility.hotControl = m_editor_control_id; //Plain control is the POI if (Event.current.shift != true) { m_poi.m_manager.MovePoi(m_poi, Vector3.down * 0.5f); } else //Shift is the POI target { m_poi.m_manager.MovePoiLookat(m_poi, Vector3.down * 0.5f); } m_poi.m_manager.MoveTargetToPoi(m_poi); EditorUtility.SetDirty(m_poi); Event.current.Use(); GUIUtility.hotControl = 0; return; } //Left key if (Event.current.keyCode == m_poi.m_manager.m_defaults.m_keyLeft) { GUIUtility.hotControl = m_editor_control_id; Vector3 movement = Quaternion.Euler(0F, SceneView.lastActiveSceneView.rotation.eulerAngles.y, 0f) * Vector3.left; //Plain control is the POI if (Event.current.shift != true) { m_poi.m_manager.MovePoi(m_poi, movement * 0.5f); } else //Shift is the POI target { m_poi.m_manager.MovePoiLookat(m_poi, movement * 0.5f); } m_poi.m_manager.MoveTargetToPoi(m_poi); EditorUtility.SetDirty(m_poi); Event.current.Use(); GUIUtility.hotControl = 0; return; } //Forward key if (Event.current.keyCode == m_poi.m_manager.m_defaults.m_keyForward) { GUIUtility.hotControl = m_editor_control_id; Vector3 movement = Quaternion.Euler(0F, SceneView.lastActiveSceneView.rotation.eulerAngles.y, 0f) * Vector3.forward; //Plain control is the POI if (Event.current.shift != true) { m_poi.m_manager.MovePoi(m_poi, movement * 0.5f); } else //Shift is the POI target { m_poi.m_manager.MovePoiLookat(m_poi, movement * 0.5f); } m_poi.m_manager.MoveTargetToPoi(m_poi); EditorUtility.SetDirty(m_poi); Event.current.Use(); GUIUtility.hotControl = 0; return; } //Right if (Event.current.keyCode == m_poi.m_manager.m_defaults.m_keyRight) { GUIUtility.hotControl = m_editor_control_id; Vector3 movement = Quaternion.Euler(0F, SceneView.lastActiveSceneView.rotation.eulerAngles.y, 0f) * Vector3.right; //Plain control is the POI if (Event.current.shift != true) { m_poi.m_manager.MovePoi(m_poi, movement * 0.5f); } else //Shift is the POI target { m_poi.m_manager.MovePoiLookat(m_poi, movement * 0.5f); } m_poi.m_manager.MoveTargetToPoi(m_poi); EditorUtility.SetDirty(m_poi); Event.current.Use(); GUIUtility.hotControl = 0; return; } //Backward if (Event.current.keyCode == m_poi.m_manager.m_defaults.m_keyBackward) { GUIUtility.hotControl = m_editor_control_id; Vector3 movement = Quaternion.Euler(0F, SceneView.lastActiveSceneView.rotation.eulerAngles.y, 0f) * Vector3.back; //Plain control is the POI if (Event.current.shift != true) { m_poi.m_manager.MovePoi(m_poi, movement * 0.5f); } else //Shift is the POI target { m_poi.m_manager.MovePoiLookat(m_poi, movement * 0.5f); } m_poi.m_manager.MoveTargetToPoi(m_poi); EditorUtility.SetDirty(m_poi); Event.current.Use(); GUIUtility.hotControl = 0; return; } //Next POI if (Event.current.keyCode == m_poi.m_manager.m_defaults.m_keyPrevPoi) { GUIUtility.hotControl = m_editor_control_id; PegasusPoi poi = m_poi.m_manager.GetPrevPOI(m_poi); if (poi != null) { if (Selection.activeTransform != null) { Selection.activeTransform = poi.transform; } if (SceneView.lastActiveSceneView != null) { SceneView.lastActiveSceneView.pivot = poi.transform.position; } m_poi = poi; m_poi.m_manager.MoveTargetToPoi(m_poi); } Event.current.Use(); GUIUtility.hotControl = 0; return; } //Prev POI if (Event.current.keyCode == m_poi.m_manager.m_defaults.m_keyNextPoi) { GUIUtility.hotControl = m_editor_control_id; PegasusPoi poi = m_poi.m_manager.GetNextPOI(m_poi); if (poi != null) { if (Selection.activeTransform != null) { Selection.activeTransform = poi.transform; } if (SceneView.lastActiveSceneView != null) { SceneView.lastActiveSceneView.pivot = poi.transform.position; } m_poi = poi; m_poi.m_manager.MoveTargetToPoi(m_poi); } Event.current.Use(); GUIUtility.hotControl = 0; return; } } //Now handle mouse clicks that would add new pegasus poi if (Event.current.control == true && Event.current.isMouse == true) { if (Event.current.type == EventType.MouseDown && Event.current.button == 0) { GUIUtility.hotControl = m_editor_control_id; Ray ray = HandleUtility.GUIPointToWorldRay(Event.current.mousePosition); RaycastHit hitInfo; if (Physics.Raycast(ray, out hitInfo, 10000f)) { Vector3 newPoint = m_poi.m_manager.GetValidatedPoiPosition(hitInfo.point); if (newPoint != m_lastHitPoint) { m_lastHitPoint = newPoint; m_poi.m_manager.AddPOI(m_lastHitPoint, m_lastHitPoint); } } else { if (SceneView.lastActiveSceneView != null) { float dist = Vector3.Distance(ray.origin, SceneView.lastActiveSceneView.pivot); m_lastHitPoint = Vector3.MoveTowards(ray.origin, SceneView.lastActiveSceneView.pivot, dist / 2f); } else { m_lastHitPoint = ray.origin; } if (m_poi.m_manager.m_poiList.Count == 0) { m_poi.m_manager.m_heightCheckType = PegasusConstants.HeightCheckType.None; } m_poi.m_manager.AddPOI(m_lastHitPoint, m_lastHitPoint); } SceneView.RepaintAll(); } else if (GUIUtility.hotControl == m_editor_control_id && Event.current.type == EventType.MouseUp && Event.current.button == 0) { GUIUtility.hotControl = 0; } return; } }
/// <summary> /// Draw the POI gui /// </summary> public override void OnInspectorGUI() { //Get our poi m_poi = (PegasusPoi)target; //Set up the box style if (m_boxStyle == null) { m_boxStyle = new GUIStyle(GUI.skin.box); m_boxStyle.normal.textColor = GUI.skin.label.normal.textColor; m_boxStyle.fontStyle = FontStyle.Bold; m_boxStyle.alignment = TextAnchor.UpperLeft; } //Setup the wrap style if (m_wrapStyle == null) { m_wrapStyle = new GUIStyle(GUI.skin.label); m_wrapStyle.wordWrap = true; } //Create a nice text intro GUILayout.BeginVertical("Point of Interest", m_boxStyle); GUILayout.Space(20); EditorGUILayout.LabelField("The yellow sphere will be flown through, and the blue sphere is what the camera is looking at. If the blue sphere is not shown then the camera will look along the path of the flythrough.\n\nClick on POI in scene then...\nCTRL + Keys - Move selected POI.\nSHIFT+CTRL + Keys - Move selected LookAt.\nSee PegasusDefaults for Keys.", m_wrapStyle); GUILayout.EndVertical(); EditorGUI.BeginChangeCheck(); PegasusConstants.PoiType poiType = m_poi.m_poiType; GUILayout.Space(5); GUILayout.BeginVertical("Auto Roll", m_boxStyle); GUILayout.Space(20); bool autoRoll = EditorGUILayout.Toggle(GetLabel("Auto Roll"), m_poi.m_autoRollOn); GUILayout.Space(3); GUILayout.EndVertical(); GUILayout.Space(5); GUILayout.BeginVertical("Target Lookat", m_boxStyle); GUILayout.Space(20); PegasusConstants.LookatType lookatType = (PegasusConstants.LookatType)EditorGUILayout.EnumPopup(GetLabel("Target"), m_poi.m_lookatType); float lookAtAngle = m_poi.m_lookAtAngle; float lookAtDistance = m_poi.m_lookAtDistance; float lookAtHeight = m_poi.m_lookAtHeight; if (lookatType == PegasusConstants.LookatType.Path) { GUI.enabled = false; } lookAtAngle = EditorGUILayout.Slider(GetLabel(" Angle"), m_poi.m_lookAtAngle, 0f, 359.9f); lookAtDistance = EditorGUILayout.FloatField(GetLabel(" Distance"), m_poi.m_lookAtDistance); lookAtHeight = EditorGUILayout.FloatField(GetLabel(" Height"), m_poi.m_lookAtHeight); GUI.enabled = true; GUILayout.Space(3); GUILayout.EndVertical(); GUILayout.Space(5); GUILayout.BeginVertical("Target Speed", m_boxStyle); GUILayout.Space(20); PegasusConstants.SpeedType speedType = (PegasusConstants.SpeedType)EditorGUILayout.EnumPopup(GetLabel("Type"), m_poi.m_startSpeedType); float startSpeed = m_poi.m_startSpeed; if (speedType != PegasusConstants.SpeedType.Custom) { EditorGUILayout.LabelField(GetLabel("Speed"), GetLabel(string.Format("{0:0.00} m/sec", startSpeed))); } else { startSpeed = EditorGUILayout.FloatField(GetLabel("Speed"), startSpeed); if (startSpeed < 0.0001f) { startSpeed = 0.0001f; } } GUILayout.Space(3); GUILayout.EndVertical(); GUILayout.Space(5); GUILayout.BeginVertical("Height Constraint", m_boxStyle); GUILayout.Space(20); PegasusConstants.PoiHeightCheckType heightCheckType = (PegasusConstants.PoiHeightCheckType)EditorGUILayout.EnumPopup(GetLabel("Min Height From"), m_poi.m_heightCheckType); GUILayout.Space(3); GUILayout.EndVertical(); GUILayout.Space(5); GUILayout.BeginVertical("Statistics", m_boxStyle); GUILayout.Space(20); EditorGUILayout.LabelField("Distance", string.Format("{0:0.00m}", m_poi.m_segmentDistance)); EditorGUILayout.LabelField("Start Time", string.Format("{0}:{1:00}.{2:000}", m_poi.m_segmentStartTime.Minutes, m_poi.m_segmentStartTime.Seconds, m_poi.m_segmentStartTime.Milliseconds)); EditorGUILayout.LabelField("Segment Time", string.Format("{0}:{1:00}.{2:000}", m_poi.m_segmentDuration.Minutes, m_poi.m_segmentDuration.Seconds, m_poi.m_segmentDuration.Milliseconds)); EditorGUILayout.LabelField("Total Time", string.Format("{0}:{1:00}.{2:000}", m_poi.m_manager.m_totalDuration.Minutes, m_poi.m_manager.m_totalDuration.Seconds, m_poi.m_manager.m_totalDuration.Milliseconds)); GUILayout.Space(3); GUILayout.EndVertical(); PegasusConstants.EasingType velocityEasing = m_poi.m_velocityEasingType; PegasusConstants.EasingType rotationEasing = m_poi.m_rotationEasingType; PegasusConstants.EasingType positionEasing = m_poi.m_positionEasingType; GUILayout.Space(5); GUILayout.BeginVertical("Utilities", m_boxStyle); GUILayout.Space(20); if (GUILayout.Button(GetLabel("Select Manager"))) { if (Selection.activeTransform != null) { Selection.activeTransform = m_poi.m_manager.transform; } } if (GUILayout.Button(GetLabel("Select First POI"))) { PegasusPoi poi = m_poi.m_manager.GetFirstPOI(); if (poi != null) { if (SceneView.lastActiveSceneView != null) { SceneView.lastActiveSceneView.pivot = poi.transform.position; } if (Selection.activeTransform != null) { Selection.activeTransform = poi.transform; } poi.m_manager.SelectPoi(poi); poi.m_manager.MoveTargetToPoi(poi); } } GUILayout.BeginHorizontal(); if (GUILayout.Button(GetLabel("Select Previous POI"))) { PegasusPoi poi = m_poi.m_manager.GetPrevPOI(m_poi); if (poi != null) { if (Selection.activeTransform != null) { Selection.activeTransform = poi.transform; } if (SceneView.lastActiveSceneView != null) { SceneView.lastActiveSceneView.pivot = poi.transform.position; } poi.m_manager.SelectPoi(poi); poi.m_manager.MoveTargetToPoi(poi); } } if (GUILayout.Button(GetLabel("Select Next POI"))) { PegasusPoi poi = m_poi.m_manager.GetNextPOI(m_poi); if (poi != null) { if (Selection.activeTransform != null) { Selection.activeTransform = poi.transform; } if (SceneView.lastActiveSceneView != null) { SceneView.lastActiveSceneView.pivot = poi.transform.position; } poi.m_manager.SelectPoi(poi); poi.m_manager.MoveTargetToPoi(poi); } } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button(GetLabel("Add POI Before"))) { PegasusPoi poi = m_poi.m_manager.AddPoiBefore(m_poi); if (poi != null) { if (Selection.activeTransform != null) { Selection.activeTransform = poi.transform; } if (SceneView.lastActiveSceneView != null) { SceneView.lastActiveSceneView.pivot = poi.transform.position; } poi.m_manager.SelectPoi(poi); poi.m_manager.MoveTargetToPoi(poi); } } if (GUILayout.Button(GetLabel("Add POI After"))) { PegasusPoi poi = m_poi.m_manager.AddPoiAfter(m_poi); if (poi != null) { if (Selection.activeTransform != null) { Selection.activeTransform = poi.transform; } if (SceneView.lastActiveSceneView != null) { SceneView.lastActiveSceneView.pivot = poi.transform.position; } poi.m_manager.SelectPoi(poi); poi.m_manager.MoveTargetToPoi(poi); } } GUILayout.EndHorizontal(); GUILayout.Space(3); GUILayout.EndVertical(); //Check for changes, make undo record, make changes and let editor know we are dirty if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(m_poi, "Made changes"); m_poi.m_poiType = poiType; m_poi.m_autoRollOn = autoRoll; if (m_poi.m_lookatType != lookatType && lookatType == PegasusConstants.LookatType.Target) { lookAtHeight = 0f; lookAtDistance = 5f; } m_poi.m_lookatType = lookatType; if (heightCheckType != m_poi.m_heightCheckType) { m_poi.m_heightCheckType = heightCheckType; //m_poi.m_manager.UpdateSegmentWithDependencies(m_poi); } if (!PegasusPoi.ApproximatelyEqual(m_poi.m_lookAtAngle, lookAtAngle)) { m_poi.m_lookAtAngle = lookAtAngle; m_poi.m_lookatLocation = m_poi.transform.position + (m_poi.transform.localRotation * Quaternion.AngleAxis(m_poi.m_lookAtAngle, Vector3.up)) * new Vector3(0f, 0f, -m_poi.m_lookAtDistance); m_poi.m_lookatLocation = m_poi.m_manager.GetLowestLookatPosition(m_poi.m_lookatLocation, m_poi.m_heightCheckType); m_poi.m_lookatLocation.y += m_poi.m_lookAtHeight; } else if (!PegasusPoi.ApproximatelyEqual(m_poi.m_lookAtDistance, lookAtDistance)) { m_poi.m_lookAtDistance = lookAtDistance; m_poi.m_lookatLocation = m_poi.transform.position + (m_poi.transform.localRotation * Quaternion.AngleAxis(m_poi.m_lookAtAngle, Vector3.up)) * new Vector3(0f, 0f, -m_poi.m_lookAtDistance); m_poi.m_lookatLocation = m_poi.m_manager.GetLowestLookatPosition(m_poi.m_lookatLocation, m_poi.m_heightCheckType); m_poi.m_lookatLocation.y += m_poi.m_lookAtHeight; } else if (!PegasusPoi.ApproximatelyEqual(m_poi.m_lookAtHeight, lookAtHeight)) { m_poi.m_lookAtHeight = lookAtHeight; m_poi.m_lookatLocation = m_poi.transform.position + (m_poi.transform.localRotation * Quaternion.AngleAxis(m_poi.m_lookAtAngle, Vector3.up)) * new Vector3(0f, 0f, -m_poi.m_lookAtDistance); m_poi.m_lookatLocation = m_poi.m_manager.GetLowestLookatPosition(m_poi.m_lookatLocation, m_poi.m_heightCheckType); m_poi.m_lookatLocation.y += m_poi.m_lookAtHeight; } if (m_poi.m_startSpeedType != speedType) { m_poi.m_startSpeedType = speedType; m_poi.m_startSpeed = m_poi.GetStartSpeed(speedType); } else { if (!PegasusPoi.ApproximatelyEqual(m_poi.m_startSpeed, startSpeed)) { m_poi.m_startSpeedType = PegasusConstants.SpeedType.Custom; m_poi.m_startSpeed = startSpeed; } } m_poi.m_velocityEasingType = velocityEasing; m_poi.m_rotationEasingType = rotationEasing; m_poi.m_positionEasingType = positionEasing; //Update the segment m_poi.m_manager.UpdateSegmentWithDependencies(m_poi); //Mark it as dirty EditorUtility.SetDirty(m_poi); } }
public override void OnInspectorGUI() { //Get our manager m_manager = (PegasusManager)target; //Set up the box style if (m_boxStyle == null) { m_boxStyle = new GUIStyle(GUI.skin.box); m_boxStyle.normal.textColor = GUI.skin.label.normal.textColor; m_boxStyle.fontStyle = FontStyle.Bold; m_boxStyle.alignment = TextAnchor.UpperLeft; } //Setup the wrap style if (m_wrapStyle == null) { m_wrapStyle = new GUIStyle(GUI.skin.label); m_wrapStyle.fontStyle = FontStyle.Normal; m_wrapStyle.wordWrap = true; } //Text intro GUILayout.BeginVertical(string.Format("Pegasus ({0}.{1})", PegasusConstants.MajorVersion, PegasusConstants.MinorVersion), m_boxStyle); GUILayout.Space(20); EditorGUILayout.LabelField("Welcome to Pegasus!\nTo visualise flythrough in editor mode select Window->Layouts->2 x 3 so that both Scene & Game windows are showing.\nCtrl + Left Click: Add POI.\nCrtl + ScrollWheel: Scrub timeline.", m_wrapStyle); GUILayout.EndVertical(); EditorGUI.BeginChangeCheck(); GUILayout.Space(5); GUILayout.BeginVertical("Configuration", m_boxStyle); GUILayout.Space(20); GameObject poiTarget = (GameObject)EditorGUILayout.ObjectField(GetLabel("Target Object"), m_manager.m_target, typeof(GameObject), true); PegasusConstants.FlythroughType flythroughType = (PegasusConstants.FlythroughType)EditorGUILayout.EnumPopup(GetLabel("Flythrough Type"), m_manager.m_flythroughType); PegasusConstants.FlythroughEndAction flythroughEndAction = m_manager.m_flythroughEndAction; PegasusManager nextPegasus = m_manager.m_nextPegasus; if (flythroughType == PegasusConstants.FlythroughType.SingleShot) { flythroughEndAction = (PegasusConstants.FlythroughEndAction)EditorGUILayout.EnumPopup(GetLabel("Flythrough End"), flythroughEndAction); if (flythroughEndAction == PegasusConstants.FlythroughEndAction.PlayNextPegasus) { nextPegasus = (PegasusManager)EditorGUILayout.ObjectField(GetLabel("Next Pegasus"), nextPegasus, typeof(PegasusManager), true); } } bool autoStartAtRuntime = EditorGUILayout.Toggle(GetLabel("Play On Start"), m_manager.m_autoStartAtRuntime); PegasusConstants.TargetFrameRate targetFrameRateType = m_manager.m_targetFramerateType; PegasusConstants.HeightCheckType heightCheckType = m_manager.m_heightCheckType; float minHeightAboveTerrain = m_manager.m_minHeightAboveTerrain; float collisionHeightOffset = m_manager.m_collisionHeightOffset; float rotationDamping = m_manager.m_rotationDamping; float positionDamping = m_manager.m_positionDamping; float poiSize = m_manager.m_poiGizmoSize; bool showAdvanced = EditorGUILayout.BeginToggleGroup(GetLabel(" Advanced"), m_manager.m_showAdvanced); if (showAdvanced) { EditorGUI.indentLevel++; targetFrameRateType = (PegasusConstants.TargetFrameRate)EditorGUILayout.EnumPopup(GetLabel("Framerate"), m_manager.m_targetFramerateType); heightCheckType = (PegasusConstants.HeightCheckType)EditorGUILayout.EnumPopup(GetLabel("Check Height"), m_manager.m_heightCheckType); if (heightCheckType != PegasusConstants.HeightCheckType.None) { if (heightCheckType == PegasusConstants.HeightCheckType.Collision) { collisionHeightOffset = EditorGUILayout.FloatField(GetLabel("Collision Offset"), collisionHeightOffset); } minHeightAboveTerrain = EditorGUILayout.FloatField(GetLabel("Min POI Height"), minHeightAboveTerrain); } rotationDamping = EditorGUILayout.Slider(GetLabel("Rotation Damping"), m_manager.m_rotationDamping, 0f, 3f); positionDamping = EditorGUILayout.Slider(GetLabel("Position Damping"), m_manager.m_positionDamping, 0f, 3f); poiSize = EditorGUILayout.Slider(GetLabel("Gizmo Size"), poiSize, 0.1f, 5f); EditorGUI.indentLevel--; } EditorGUILayout.EndToggleGroup(); GUILayout.Space(3); GUILayout.Space(3); GUILayout.EndVertical(); GUILayout.Space(5); GUILayout.BeginVertical("Statistics", m_boxStyle); GUILayout.Space(20); EditorGUILayout.LabelField("Distance", string.Format("{0:0.00m}", m_manager.m_totalDistance)); EditorGUILayout.LabelField("Duration", string.Format("{0}:{1:00}.{2:000}", m_manager.m_totalDuration.Minutes, m_manager.m_totalDuration.Seconds, m_manager.m_totalDuration.Milliseconds)); GUILayout.Space(3); GUILayout.EndVertical(); GUILayout.Space(5); GUILayout.BeginVertical(m_boxStyle); float scrubber = m_manager.m_totalDistanceTravelledPct; m_manager.m_showScrubber = EditorGUILayout.BeginToggleGroup(GetLabel(" Visualisation"), m_manager.m_showScrubber); bool showDebug = m_manager.m_displayDebug; bool alwaysShowGizmos = m_manager.m_alwaysShowGizmos; if (m_manager.m_showScrubber) { EditorGUILayout.LabelField("Switch to Game View and use the Scrubber and Step controls to visualise the flythrough path while in edit mode. This will physically move your Target in the scene so make sure you put it back to its original location afterwards.", m_wrapStyle); scrubber = EditorGUILayout.Slider(GetLabel("Scrubber"), scrubber, 0f, 1f); GUILayout.BeginHorizontal(); if (GUILayout.Button(GetLabel("Step Backward"))) { m_manager.StepTargetBackward(1f); scrubber = m_manager.m_totalDistanceTravelledPct; } if (GUILayout.Button(GetLabel("Step Forward"))) { m_manager.StepTargetForward(1f); scrubber = m_manager.m_totalDistanceTravelledPct; } GUILayout.EndHorizontal(); alwaysShowGizmos = EditorGUILayout.Toggle(GetLabel("Show Gizmos"), alwaysShowGizmos); showDebug = EditorGUILayout.Toggle(GetLabel("Show debug"), showDebug); } EditorGUILayout.EndToggleGroup(); GUILayout.Space(3); GUILayout.EndVertical(); GUILayout.Space(5); GUILayout.BeginVertical(m_boxStyle); m_manager.m_showPOIHelpers = EditorGUILayout.BeginToggleGroup(GetLabel(" Utilities"), m_manager.m_showPOIHelpers); if (m_manager.m_showPOIHelpers) { if (GUILayout.Button(GetLabel("Go To First POI"))) { PegasusPoi poi = m_manager.GetPOI(0); if (poi != null) { if (Selection.activeTransform != null) { Selection.activeTransform = poi.transform; } if (SceneView.lastActiveSceneView != null) { SceneView.lastActiveSceneView.pivot = poi.transform.position; } poi.m_manager.SelectPoi(poi); poi.m_manager.MoveTargetToPoi(poi); } } if (GUILayout.Button(GetLabel("Set POI To Min Height"))) { m_manager.SetPoiToMinHeight(); } if (GUILayout.Button(GetLabel("Show Debug On POI"))) { m_manager.CreateDebugObjects(); } if (GUILayout.Button(GetLabel("Hide Debug on POI"))) { m_manager.DeleteDebugObjects(); } } EditorGUILayout.EndToggleGroup(); GUILayout.Space(3); GUILayout.EndVertical(); GUILayout.Space(5); //Display some playback controls if (EditorApplication.isPlaying) { GUILayout.BeginVertical("Playback Status", m_boxStyle); GUILayout.Space(20); EditorGUILayout.LabelField("Status", m_manager.m_currentState.ToString()); if (m_manager.m_currentState == PegasusConstants.FlythroughState.Started) { EditorGUILayout.LabelField("Delta Time", string.Format("{0:0.000}", m_manager.m_frameUpdateTime)); EditorGUILayout.LabelField("Delta Dist", string.Format("{0:0.000}", m_manager.m_frameUpdateDistance)); EditorGUILayout.LabelField("Current Speed", string.Format("{0:0.00}", m_manager.m_currentVelocity)); EditorGUILayout.LabelField("Distance Travelled", string.Format("{0:0.00}", m_manager.m_totalDistanceTravelled)); EditorGUILayout.LabelField("Total Distance", string.Format("{0:0.00}", m_manager.m_totalDistance)); } else { EditorGUILayout.LabelField("Delta Time", string.Format("{0:0.000}", 0f)); EditorGUILayout.LabelField("Delta Dist", string.Format("{0:0.000}", 0f)); EditorGUILayout.LabelField("Current Speed", string.Format("{0:0.00}", 0f)); EditorGUILayout.LabelField("Distance Travelled", string.Format("{0:0.00}", m_manager.m_totalDistanceTravelled)); EditorGUILayout.LabelField("Total Distance", string.Format("{0:0.00}", m_manager.m_totalDistance)); } if (m_manager.m_currentState == PegasusConstants.FlythroughState.Stopped) { if (GUILayout.Button(GetLabel("Play"))) { m_manager.StartFlythrough(); } } else { GUILayout.BeginHorizontal(); if (m_manager.m_currentState == PegasusConstants.FlythroughState.Paused) { if (GUILayout.Button(GetLabel("Resume"))) { m_manager.ResumeFlythrough(); } } else if (m_manager.m_currentState == PegasusConstants.FlythroughState.Started) { if (GUILayout.Button(GetLabel("Pause"))) { m_manager.PauseFlythrough(); } } if (GUILayout.Button(GetLabel("Stop"))) { m_manager.StopFlythrough(); } GUILayout.EndHorizontal(); } GUILayout.Space(3); GUILayout.EndVertical(); } if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(m_manager, "Made changes"); m_manager.m_autoStartAtRuntime = autoStartAtRuntime; m_manager.m_displayDebug = showDebug; m_manager.m_alwaysShowGizmos = alwaysShowGizmos; m_manager.m_collisionHeightOffset = collisionHeightOffset; m_manager.m_showAdvanced = showAdvanced; m_manager.m_poiGizmoSize = poiSize; if (m_manager.m_flythroughType != flythroughType) { m_manager.m_flythroughType = flythroughType; m_manager.InitialiseFlythrough(); } m_manager.m_nextPegasus = nextPegasus; if (m_manager.m_heightCheckType != heightCheckType) { m_manager.m_heightCheckType = heightCheckType; m_manager.InitialiseFlythrough(); } m_manager.m_flythroughEndAction = flythroughEndAction; m_manager.m_target = poiTarget; if (m_manager.m_targetFramerateType != targetFrameRateType) { m_manager.ChangeFramerate(targetFrameRateType); } if (!PegasusPoi.ApproximatelyEqual(scrubber, m_manager.m_totalDistanceTravelledPct)) { m_manager.MoveTargetTo(scrubber); } if (!PegasusPoi.ApproximatelyEqual(minHeightAboveTerrain, m_manager.m_minHeightAboveTerrain)) { m_manager.m_minHeightAboveTerrain = minHeightAboveTerrain; m_manager.InitialiseFlythrough(); } m_manager.m_rotationDamping = rotationDamping; m_manager.m_positionDamping = positionDamping; EditorUtility.SetDirty(m_manager); } }
/// <summary> /// Called when the trigger starts /// </summary> /// <param name="poi"></param> public override void OnStart(PegasusPoi poi) { if (poi == null) { Debug.LogWarning(string.Format("Poi was not supplied on {0} - exiting", name)); return; } if (m_pegasus == null) { Debug.LogWarning(string.Format("Pegasus was not supplied on {0} - exiting", name)); return; } if (m_disabled) { return; } if (m_triggerAtStart) { switch (m_actionOnStart) { case PegasusConstants.PoiPegasusTriggerAction.PlayPegasus: if (poi.m_manager.m_displayDebug == true) { Debug.Log(string.Format("Started flythrough on {0} from {1}", poi.m_manager.name, poi.name)); } //Stop playback of the calling pegasus if the new one has the same target if (poi.m_manager.m_target != null && m_pegasus.m_target != null) { if (poi.m_manager.m_target.GetInstanceID() == m_pegasus.m_target.GetInstanceID()) { poi.m_manager.StopFlythrough(); } } //And start the new one if (m_pegasus.m_currentState == PegasusConstants.FlythroughState.Paused) { m_pegasus.ResumeFlythrough(); } else { m_pegasus.StartFlythrough(); } if (m_disableAfterActioned) { m_disabled = true; } break; case PegasusConstants.PoiPegasusTriggerAction.PausePegasus: if (poi.m_manager.m_displayDebug == true) { Debug.Log(string.Format("Pausing flythrough on {0} from {1}", poi.m_manager.name, poi.name)); } m_pegasus.PauseFlythrough(); if (m_disableAfterActioned) { m_disabled = true; } break; case PegasusConstants.PoiPegasusTriggerAction.ResumePegasus: if (poi.m_manager.m_displayDebug == true) { Debug.Log(string.Format("Resuming flythrough on {0} from {1}", poi.m_manager.name, poi.name)); } m_pegasus.ResumeFlythrough(); if (m_disableAfterActioned) { m_disabled = true; } break; case PegasusConstants.PoiPegasusTriggerAction.StopPegasus: if (poi.m_manager.m_displayDebug == true) { Debug.Log(string.Format("Stopping flythrough on {0} from {1}", poi.m_manager.name, poi.name)); } m_pegasus.StopFlythrough(); if (m_disableAfterActioned) { m_disabled = true; } break; case PegasusConstants.PoiPegasusTriggerAction.DoNothing: if (poi.m_manager.m_displayDebug == true) { Debug.Log(string.Format("Doing nothing on {0} from {1}", poi.m_manager.name, poi.name)); } break; } } }
/// <summary> /// Called when the trigger ends /// </summary> /// <param name="poi"></param> public override void OnEnd(PegasusPoi poi) { if (poi == null) { Debug.LogWarning(string.Format("Poi was not supplied on {0} - exiting", name)); return; } if (m_pegasus == null) { Debug.LogWarning(string.Format("Pegasus was not supplied on {0} - exiting", name)); return; } if (m_disabled) { return; } if (m_triggerAtEnd) { switch (m_actionOnEnd) { case PegasusConstants.PoiPegasusTriggerAction.PlayPegasus: if (poi.m_manager.m_displayDebug == true) { Debug.Log(string.Format("Started flythrough on {0} from {1}", poi.m_manager.name, poi.name)); } //Stop current pegasus (hack) poi.m_manager.StopFlythrough(); if (m_pegasus.m_currentState == PegasusConstants.FlythroughState.Paused) { m_pegasus.ResumeFlythrough(); } else { m_pegasus.StartFlythrough(); } if (m_disableAfterActioned) { m_disabled = true; } break; case PegasusConstants.PoiPegasusTriggerAction.PausePegasus: if (poi.m_manager.m_displayDebug == true) { Debug.Log(string.Format("Pausing flythrough on {0} from {1}", poi.m_manager.name, poi.name)); } m_pegasus.PauseFlythrough(); if (m_disableAfterActioned) { m_disabled = true; } break; case PegasusConstants.PoiPegasusTriggerAction.ResumePegasus: if (poi.m_manager.m_displayDebug == true) { Debug.Log(string.Format("Resuming flythrough on {0} from {1}", poi.m_manager.name, poi.name)); } m_pegasus.ResumeFlythrough(); if (m_disableAfterActioned) { m_disabled = true; } break; case PegasusConstants.PoiPegasusTriggerAction.StopPegasus: if (poi.m_manager.m_displayDebug == true) { Debug.Log(string.Format("Stopping flythrough on {0} from {1}", poi.m_manager.name, poi.name)); } m_pegasus.StopFlythrough(); if (m_disableAfterActioned) { m_disabled = true; } break; case PegasusConstants.PoiPegasusTriggerAction.DoNothing: if (poi.m_manager.m_displayDebug == true) { Debug.Log(string.Format("Doing nothing on {0} from {1}", poi.m_manager.name, poi.name)); } break; } } }