public override void ShowGUI(List <ActionParameter> parameters) { dragParameterID = Action.ChooseParameterGUI("Draggable object:", parameters, dragParameterID, ParameterType.GameObject); if (dragParameterID >= 0) { dragConstantID = 0; dragObject = null; } else { dragObject = (Moveable_Drag)EditorGUILayout.ObjectField("Draggable object:", dragObject, typeof(Moveable_Drag), true); dragConstantID = FieldToID <Moveable_Drag> (dragObject, dragConstantID); dragObject = IDToField <Moveable_Drag> (dragObject, dragConstantID, false); if (dragObject != null && dragObject.dragMode != DragMode.LockToTrack) { EditorGUILayout.HelpBox("The chosen Drag object must be in 'Lock To Track' mode", MessageType.Warning); } } newTrack = (DragTrack)EditorGUILayout.ObjectField("Track (optional):", newTrack, typeof(DragTrack), true); newTrackConstantID = FieldToID <DragTrack>(newTrack, newTrackConstantID); newTrack = IDToField <DragTrack>(newTrack, newTrackConstantID, false); positionParameterID = Action.ChooseParameterGUI("New track position:", parameters, positionParameterID, ParameterType.Float); if (positionParameterID < 0) { positionAlong = EditorGUILayout.Slider("New track position:", positionAlong, 0f, 1f); } if (newTrack == null) { isInstant = EditorGUILayout.Toggle("Is instant?", isInstant); if (!isInstant) { speed = EditorGUILayout.FloatField("Movement speed:", speed); removePlayerControl = EditorGUILayout.Toggle("Remove player control?", removePlayerControl); stopOnCollide = EditorGUILayout.Toggle("Stop if has collision?", stopOnCollide); if (stopOnCollide) { layerMask = AdvGame.LayerMaskField("'Stop' collision layer(s):", layerMask); } willWait = EditorGUILayout.Toggle("Wait until finish?", willWait); } } AfterRunningOption(); }
public override void OnInspectorGUI() { GameCameraThirdPerson _target = (GameCameraThirdPerson)target; // Target EditorGUILayout.BeginVertical("Button"); EditorGUILayout.LabelField("Target", EditorStyles.boldLabel); _target.targetIsPlayer = EditorGUILayout.Toggle("Is player?", _target.targetIsPlayer); if (!_target.targetIsPlayer) { _target.target = (Transform)EditorGUILayout.ObjectField("Target transform:", _target.target, typeof(Transform), true); } _target.horizontalOffset = EditorGUILayout.FloatField("Horizontal offset:", _target.horizontalOffset); _target.verticalOffset = EditorGUILayout.FloatField("Vertical offset:", _target.verticalOffset); EditorGUILayout.EndVertical(); // Distance EditorGUILayout.BeginVertical("Button"); EditorGUILayout.LabelField("Distance", EditorStyles.boldLabel); _target.distance = EditorGUILayout.FloatField("Distance from target:", _target.distance); _target.allowMouseWheelZooming = EditorGUILayout.Toggle("Mousewheel zooming?", _target.allowMouseWheelZooming); _target.detectCollisions = EditorGUILayout.Toggle("Detect wall collisions?", _target.detectCollisions); if (_target.detectCollisions) { _target.collisionOffset = EditorGUILayout.FloatField("Collision offset:", _target.collisionOffset); if (_target.collisionOffset < 0f) { _target.collisionOffset = 0f; } _target.collisionLayerMask = AdvGame.LayerMaskField("Collision layer(s):", _target.collisionLayerMask); } if (_target.allowMouseWheelZooming || _target.detectCollisions) { _target.minDistance = EditorGUILayout.FloatField("Mininum distance:", _target.minDistance); } if (_target.allowMouseWheelZooming) { _target.maxDistance = EditorGUILayout.FloatField("Maximum distance:", _target.maxDistance); } EditorGUILayout.EndVertical(); // Spin EditorGUILayout.BeginVertical("Button"); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Spin rotation", EditorStyles.boldLabel, GUILayout.Width(130f)); _target.spinLock = (RotationLock)EditorGUILayout.EnumPopup(_target.spinLock); EditorGUILayout.EndHorizontal(); if (_target.spinLock != RotationLock.Locked) { _target.spinSpeed = EditorGUILayout.FloatField("Speed:", _target.spinSpeed); _target.spinAccleration = EditorGUILayout.FloatField("Acceleration:", _target.spinAccleration); _target.spinDeceleration = EditorGUILayout.FloatField("Deceleration:", _target.spinDeceleration); _target.isDragControlled = EditorGUILayout.Toggle("Drag-controlled?", _target.isDragControlled); if (!_target.isDragControlled) { _target.spinAxis = EditorGUILayout.TextField("Input axis:", _target.spinAxis); } _target.inputAffectsSpeed = EditorGUILayout.ToggleLeft("Scale speed with input magnitude?", _target.inputAffectsSpeed); _target.invertSpin = EditorGUILayout.Toggle("Invert?", _target.invertSpin); _target.toggleCursor = EditorGUILayout.Toggle("Cursor must be locked?", _target.toggleCursor); _target.resetSpinWhenSwitch = EditorGUILayout.Toggle("Reset angle on switch?", _target.resetSpinWhenSwitch); if (_target.spinLock == RotationLock.Limited) { _target.maxSpin = EditorGUILayout.FloatField("Maximum angle:", _target.maxSpin); } } if (_target.spinLock != RotationLock.Free) { _target.alwaysBehind = EditorGUILayout.Toggle("Always behind target?", _target.alwaysBehind); if (_target.alwaysBehind) { _target.spinAccleration = EditorGUILayout.FloatField("Acceleration:", _target.spinAccleration); _target.spinOffset = EditorGUILayout.FloatField("Offset angle:", _target.spinOffset); } } EditorGUILayout.EndVertical(); // Pitch EditorGUILayout.BeginVertical("Button"); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Pitch rotation", EditorStyles.boldLabel, GUILayout.Width(130f)); _target.pitchLock = (RotationLock)EditorGUILayout.EnumPopup(_target.pitchLock); EditorGUILayout.EndHorizontal(); if (_target.pitchLock != RotationLock.Locked) { _target.pitchSpeed = EditorGUILayout.FloatField("Speed:", _target.pitchSpeed); _target.pitchAccleration = EditorGUILayout.FloatField("Acceleration:", _target.pitchAccleration); _target.pitchDeceleration = EditorGUILayout.FloatField("Deceleration:", _target.pitchDeceleration); _target.isDragControlled = EditorGUILayout.Toggle("Drag-controlled?", _target.isDragControlled); if (!_target.isDragControlled) { _target.pitchAxis = EditorGUILayout.TextField("Input axis:", _target.pitchAxis); } _target.inputAffectsSpeed = EditorGUILayout.ToggleLeft("Scale speed with input magnitude?", _target.inputAffectsSpeed); _target.invertPitch = EditorGUILayout.Toggle("Invert?", _target.invertPitch); _target.resetPitchWhenSwitch = EditorGUILayout.Toggle("Reset angle on switch?", _target.resetPitchWhenSwitch); if (_target.pitchLock == RotationLock.Limited) { _target.maxPitch = EditorGUILayout.FloatField("Maximum angle:", _target.maxPitch); _target.minPitch = EditorGUILayout.FloatField("Minimum angle:", _target.minPitch); } } else { _target.maxPitch = EditorGUILayout.FloatField("Fixed angle:", _target.maxPitch); } EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical("Button"); EditorGUILayout.LabelField("Depth of field", EditorStyles.boldLabel); _target.focalPointIsTarget = EditorGUILayout.Toggle("Focal point is target object?", _target.focalPointIsTarget); if (!_target.focalPointIsTarget) { _target.focalDistance = EditorGUILayout.FloatField("Focal distance:", _target.focalDistance); } else if (Application.isPlaying) { EditorGUILayout.LabelField("Focal distance: " + _target.focalDistance.ToString(), EditorStyles.miniLabel); } EditorGUILayout.EndVertical(); DisplayInputList(_target); UnityVersionHandler.CustomSetDirty(_target); }
public override void OnInspectorGUI() { GameCameraThirdPerson _target = (GameCameraThirdPerson)target; // Target CustomGUILayout.BeginVertical(); EditorGUILayout.LabelField("Target", EditorStyles.boldLabel); _target.targetIsPlayer = CustomGUILayout.Toggle("Is player?", _target.targetIsPlayer, "", "If True, the camera will follow the active Player"); if (!_target.targetIsPlayer) { _target.target = (Transform)CustomGUILayout.ObjectField <Transform> ("Target transform:", _target.target, true, "", "The object that the camera should follow"); } _target.horizontalOffset = CustomGUILayout.FloatField("Horizontal offset:", _target.horizontalOffset, "", "The horizontal position offset"); _target.verticalOffset = CustomGUILayout.FloatField("Vertical offset:", _target.verticalOffset, "", "The vertical position offset"); CustomGUILayout.EndVertical(); // Distance CustomGUILayout.BeginVertical(); EditorGUILayout.LabelField("Distance", EditorStyles.boldLabel); _target.distance = CustomGUILayout.FloatField("Distance from target:", _target.distance, "", "The normal distance to keep from its target"); _target.allowMouseWheelZooming = CustomGUILayout.Toggle("Mousewheel zooming?", _target.allowMouseWheelZooming, "", "If True, the mousewheel can be used to zoom the camera's distance from the target"); _target.detectCollisions = CustomGUILayout.Toggle("Detect wall collisions?", _target.detectCollisions, "", "If True, then the camera will detect Colliders to try to avoid clipping through walls"); if (_target.detectCollisions) { _target.collisionRadius = CustomGUILayout.FloatField("Collision radius:", _target.collisionRadius, "", "The size of the SphereCast to use when detecting collisions"); if (_target.collisionRadius < 0f) { _target.collisionRadius = 0f; } _target.collisionLayerMask = AdvGame.LayerMaskField("Collision layer(s):", _target.collisionLayerMask, "The layers to check for when detecting collisions"); } if (_target.allowMouseWheelZooming || _target.detectCollisions) { _target.minDistance = CustomGUILayout.FloatField("Mininum distance:", _target.minDistance, "", "The minimum distance to keep from its target"); } if (_target.allowMouseWheelZooming) { _target.maxDistance = CustomGUILayout.FloatField("Maximum distance:", _target.maxDistance, "", "The maximum distance to keep from its target"); } CustomGUILayout.EndVertical(); // Spin CustomGUILayout.BeginVertical(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(new GUIContent("Spin rotation", "How spin rotation is affected"), EditorStyles.boldLabel, GUILayout.Width(130f)); _target.spinLock = (RotationLock)EditorGUILayout.EnumPopup(_target.spinLock); EditorGUILayout.EndHorizontal(); if (_target.spinLock != RotationLock.Locked) { _target.spinSpeed = CustomGUILayout.FloatField("Speed:", _target.spinSpeed, "", "The speed of spin rotations"); _target.spinAccleration = CustomGUILayout.FloatField("Acceleration:", _target.spinAccleration, "", "The acceleration of spin rotations"); _target.spinDeceleration = CustomGUILayout.FloatField("Deceleration:", _target.spinDeceleration, "", "The deceleration of spin rotations"); _target.isDragControlled = CustomGUILayout.Toggle("Drag-controlled?", _target.isDragControlled, "", "If True, then the camera can be drag-controlled"); _target.canRotateDuringCutscenes = CustomGUILayout.ToggleLeft("Can rotate during cutscenes?", _target.canRotateDuringCutscenes, "", "If True, then spin and pitch can be altered when gameplay is blocked"); _target.canRotateDuringConversations = CustomGUILayout.ToggleLeft("Can rotate during Conversations?", _target.canRotateDuringConversations, "", "If True, then spin and pitch can be altered when a Conversation is active"); if (!_target.isDragControlled) { _target.spinAxis = CustomGUILayout.TextField("Input axis:", _target.spinAxis, "", "The name of the Input axis that controls spin rotation"); } _target.inputAffectsSpeed = CustomGUILayout.ToggleLeft("Scale speed with input magnitude?", _target.inputAffectsSpeed, "", "If True, then the magnitude of the input vector affects the magnitude of the rotation speed"); _target.invertSpin = CustomGUILayout.Toggle("Invert?", _target.invertSpin, "", "If True, then the direction of spin rotations will be reversed"); _target.toggleCursor = CustomGUILayout.Toggle("Cursor must be locked?", _target.toggleCursor, "", "If True, then the cursor must be locked for spin rotation to occur"); _target.resetSpinWhenSwitch = CustomGUILayout.Toggle("Reset angle on switch?", _target.resetSpinWhenSwitch, "", "If True, then the spin rotation will be reset when the camera is made active"); if (_target.spinLock == RotationLock.Limited) { _target.maxSpin = CustomGUILayout.FloatField("Maximum angle:", _target.maxSpin, "", "The maximum spin angle"); } } if (_target.spinLock != RotationLock.Free) { _target.alwaysBehind = CustomGUILayout.Toggle("Always behind target?", _target.alwaysBehind, "", "If True, then the camera's spin rotation will be relative to the target's rotation"); if (_target.alwaysBehind) { _target.spinAccleration = CustomGUILayout.FloatField("Acceleration:", _target.spinAccleration, "", "The acceleration of spin rotations"); _target.spinOffset = CustomGUILayout.FloatField("Offset angle:", _target.spinOffset, "", "The offset in spin (yaw) angle"); } } CustomGUILayout.EndVertical(); // Pitch CustomGUILayout.BeginVertical(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(new GUIContent("Pitch rotation", "How pitch rotation is affected"), EditorStyles.boldLabel, GUILayout.Width(130f)); _target.pitchLock = (RotationLock)EditorGUILayout.EnumPopup(_target.pitchLock); EditorGUILayout.EndHorizontal(); if (_target.pitchLock != RotationLock.Locked) { _target.pitchSpeed = CustomGUILayout.FloatField("Speed:", _target.pitchSpeed, "", "The speed of pitch rotations"); _target.pitchAccleration = CustomGUILayout.FloatField("Acceleration:", _target.pitchAccleration, "", "The acceleration of pitch rotations"); _target.pitchDeceleration = CustomGUILayout.FloatField("Deceleration:", _target.pitchDeceleration, "", "The deceleration of pitch rotations"); _target.isDragControlled = CustomGUILayout.Toggle("Drag-controlled?", _target.isDragControlled, "", "If True, then the camera can be drag-controlled"); _target.canRotateDuringConversations = CustomGUILayout.ToggleLeft("Can rotate during Conversations?", _target.canRotateDuringConversations, "", "If True, then spin and pitch can be altered when a Conversation is active"); if (!_target.isDragControlled) { _target.pitchAxis = CustomGUILayout.TextField("Input axis:", _target.pitchAxis, "", "The name of the Input axis that controls pitch rotation"); } _target.inputAffectsSpeed = CustomGUILayout.ToggleLeft("Scale speed with input magnitude?", _target.inputAffectsSpeed, "", "If True, then the magnitude of the input vector affects the magnitude of the rotation speed"); _target.invertPitch = CustomGUILayout.Toggle("Invert?", _target.invertPitch, "", "If True, then the direction of pitch rotations will be reversed"); _target.resetPitchWhenSwitch = CustomGUILayout.Toggle("Reset angle on switch?", _target.resetPitchWhenSwitch, "", "If True, then the pitch rotation will be reset when the camera is made active"); if (_target.pitchLock == RotationLock.Limited) { _target.maxPitch = CustomGUILayout.FloatField("Maximum angle:", _target.maxPitch, "", "The maximum pitch angle"); _target.minPitch = CustomGUILayout.FloatField("Minimum angle:", _target.minPitch, "", "The minimum pitch angle"); } } else { _target.maxPitch = CustomGUILayout.FloatField("Fixed angle:", _target.maxPitch, "", "The fixed pitch angle"); } CustomGUILayout.EndVertical(); CustomGUILayout.BeginVertical(); EditorGUILayout.LabelField("Depth of field", EditorStyles.boldLabel); _target.focalPointIsTarget = CustomGUILayout.Toggle("Focal point is target object?", _target.focalPointIsTarget, "", "If True, then the focal distance will match the distance to the target"); if (!_target.focalPointIsTarget) { _target.focalDistance = CustomGUILayout.FloatField("Focal distance:", _target.focalDistance, "", "The camera's focal distance. When the MainCamera is attached to this camera, it can be read through script with 'AC.KickStarter.mainCamera.GetFocalDistance()' and used to update your post-processing method."); } else if (Application.isPlaying) { EditorGUILayout.LabelField("Focal distance: " + _target.focalDistance.ToString(), EditorStyles.miniLabel); } CustomGUILayout.EndVertical(); DisplayInputList(_target); UnityVersionHandler.CustomSetDirty(_target); }