コード例 #1
0
        /// <summary>
        /// Draws the custom inspector.
        /// </summary>
        public override void OnInspectorGUI()
        {
            var meleeWeapon = target as MeleeWeapon;

            if (meleeWeapon == null || serializedObject == null)
            {
                return; // How'd this happen?
            }
            base.OnInspectorGUI();

            // Show all of the fields.
            serializedObject.Update();
            EditorGUI.BeginChangeCheck();

            // A collider must exist.
            var collider = meleeWeapon.GetComponent <Collider>();

            if (collider == null)
            {
                EditorGUILayout.HelpBox("A collider must exist on the weapon.", MessageType.Error);
            }
            // As does a Rigidbody.
            var rigidbody = meleeWeapon.GetComponent <Rigidbody>();

            if (rigidbody == null)
            {
                EditorGUILayout.HelpBox("A Rigidbody must exist on the weapon.", MessageType.Error);
            }

            if ((m_AttackFoldout = EditorGUILayout.Foldout(m_AttackFoldout, "Attack Options", InspectorUtility.BoldFoldout)))
            {
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(PropertyFromName(serializedObject, "m_CanUseInAir"));
                EditorGUILayout.PropertyField(PropertyFromName(serializedObject, "m_AttackRate"));
                EditorGUILayout.PropertyField(PropertyFromName(serializedObject, "m_AttackLayer"));
                EditorGUILayout.PropertyField(PropertyFromName(serializedObject, "m_AttackHitboxes"), true);
                EditorGUILayout.PropertyField(PropertyFromName(serializedObject, "m_CanInterruptAttack"));
                EditorGUILayout.PropertyField(PropertyFromName(serializedObject, "m_SingleHitAttack"));
                EditorGUILayout.PropertyField(PropertyFromName(serializedObject, "m_WaitForEndUseEvent"));
                EditorGUILayout.PropertyField(PropertyFromName(serializedObject, "m_AttackSound"), true);
                EditorGUILayout.PropertyField(PropertyFromName(serializedObject, "m_AttackSoundDelay"));
                EditorGUI.indentLevel--;
            }

            if ((m_ImpactFoldout = EditorGUILayout.Foldout(m_ImpactFoldout, "Impact Options", InspectorUtility.BoldFoldout)))
            {
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(PropertyFromName(serializedObject, "m_DamageEvent"));
                EditorGUILayout.PropertyField(PropertyFromName(serializedObject, "m_DamageAmount"));
                EditorGUILayout.PropertyField(PropertyFromName(serializedObject, "m_ImpactForce"));
                EditorGUILayout.PropertyField(PropertyFromName(serializedObject, "m_DefaultDust"));
                EditorGUILayout.PropertyField(PropertyFromName(serializedObject, "m_DefaultImpactSound"));
                EditorGUI.indentLevel--;
            }

            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(meleeWeapon, "Inspector");
                serializedObject.ApplyModifiedProperties();
                InspectorUtility.SetObjectDirty(meleeWeapon);
            }
        }
コード例 #2
0
        /// <summary>
        /// Draws the custom inspector.
        /// </summary>
        public override void OnInspectorGUI()
        {
            var turret = target as SimpleTurret;

            if (turret == null || serializedObject == null)
            {
                return; // How'd this happen?
            }
            base.OnInspectorGUI();

            // Show all of the fields.
            serializedObject.Update();
            EditorGUI.BeginChangeCheck();

            var turretHeadProperty = PropertyFromName(serializedObject, "m_TurretHead");

            turretHeadProperty.objectReferenceValue = EditorGUILayout.ObjectField("Turret Head", turretHeadProperty.objectReferenceValue, typeof(GameObject), true, GUILayout.MinWidth(80)) as GameObject;
            if (turretHeadProperty.objectReferenceValue == null)
            {
                EditorGUILayout.HelpBox("This field is required. The turret head specifies the GameObject that can rotate to aim at the target.", MessageType.Error);
            }
            EditorGUILayout.PropertyField(PropertyFromName(serializedObject, "m_RotationSpeed"));
            EditorGUILayout.PropertyField(PropertyFromName(serializedObject, "m_TargetLayers"));

            if ((m_FireFoldout = EditorGUILayout.Foldout(m_FireFoldout, "Fire Options", InspectorUtility.BoldFoldout)))
            {
                EditorGUI.indentLevel++;
                var projectile = PropertyFromName(serializedObject, "m_Projectile");
                EditorGUILayout.PropertyField(projectile);
                if (projectile.objectReferenceValue == null)
                {
                    EditorGUILayout.HelpBox("This field is required. The projectile specifies the GameObject that will damage the target.", MessageType.Error);
                }

                var firePoint = PropertyFromName(serializedObject, "m_FirePoint");
                EditorGUILayout.PropertyField(firePoint);
                if (firePoint.objectReferenceValue == null)
                {
                    EditorGUILayout.HelpBox("This field is required. The fire point specifies where the bullet should leave the weapon.", MessageType.Error);
                }

                EditorGUILayout.PropertyField(PropertyFromName(serializedObject, "m_FireRange"));
                EditorGUILayout.PropertyField(PropertyFromName(serializedObject, "m_FireRate"));
                EditorGUI.indentLevel--;
            }

            if ((m_AudioFoldout = EditorGUILayout.Foldout(m_AudioFoldout, "Audio Options", InspectorUtility.BoldFoldout)))
            {
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(PropertyFromName(serializedObject, "m_FireSound"));
                EditorGUILayout.PropertyField(PropertyFromName(serializedObject, "m_FireSoundDelay"));
                EditorGUI.indentLevel--;
            }

            if ((m_MuzzleFlashFoldout = EditorGUILayout.Foldout(m_MuzzleFlashFoldout, "Muzzle Flash Options", InspectorUtility.BoldFoldout)))
            {
                EditorGUI.indentLevel++;
                var muzzleFlash = PropertyFromName(serializedObject, "m_MuzzleFlash");
                EditorGUILayout.PropertyField(muzzleFlash);
                if (muzzleFlash.objectReferenceValue != null)
                {
                    var muzzleFlashLocation = PropertyFromName(serializedObject, "m_MuzzleFlashLocation");
                    EditorGUILayout.PropertyField(muzzleFlashLocation);
                    if (muzzleFlashLocation == null)
                    {
                        EditorGUILayout.HelpBox("This field is required. The muzzle flash location specifies where the muzzle flash should appear from weapon.", MessageType.Error);
                    }
                }
                EditorGUI.indentLevel--;
            }

            if ((m_SmokeFoldout = EditorGUILayout.Foldout(m_SmokeFoldout, "Smoke Options", InspectorUtility.BoldFoldout)))
            {
                EditorGUI.indentLevel++;
                var smoke = PropertyFromName(serializedObject, "m_Smoke");
                EditorGUILayout.PropertyField(smoke);
                if (smoke.objectReferenceValue != null)
                {
                    var smokeLocation = PropertyFromName(serializedObject, "m_SmokeLocation");
                    EditorGUILayout.PropertyField(smokeLocation);
                    if (smokeLocation == null)
                    {
                        EditorGUILayout.HelpBox("This field is required. The smoke location specifies where the smoke should appear from the weapon.", MessageType.Error);
                    }
                }
                EditorGUI.indentLevel--;
            }

            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(turret, "Inspector");
                serializedObject.ApplyModifiedProperties();
                InspectorUtility.SetObjectDirty(turret);
            }
        }
コード例 #3
0
ファイル: HealthInspector.cs プロジェクト: TopKekstar/IAV
        /// <summary>
        /// Draws the custom inspector.
        /// </summary>
        public override void OnInspectorGUI()
        {
            var health = target as Health;

            if (health == null || serializedObject == null)
            {
                return; // How'd this happen?
            }
            base.OnInspectorGUI();

            // Show all of the fields.
            serializedObject.Update();
            EditorGUI.BeginChangeCheck();

            if (Application.isPlaying)
            {
                GUI.enabled = false;
                EditorGUILayout.FloatField("Current Health", health.CurrentHealth);
                EditorGUILayout.FloatField("Current Shield", health.CurrentShield);
                GUI.enabled = true;
            }

            EditorGUILayout.PropertyField(PropertyFromName(serializedObject, "m_Invincible"));
            EditorGUILayout.PropertyField(PropertyFromName(serializedObject, "m_MaxHealth"));
            EditorGUILayout.PropertyField(PropertyFromName(serializedObject, "m_TimeInvincibleAfterSpawn"));
            if ((m_ShieldFoldout = EditorGUILayout.Foldout(m_ShieldFoldout, "Shield Options", InspectorUtility.BoldFoldout)))
            {
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(PropertyFromName(serializedObject, "m_MaxShield"));
                EditorGUILayout.PropertyField(PropertyFromName(serializedObject, "m_ShieldRegenerativeInitialWait"));
                EditorGUILayout.PropertyField(PropertyFromName(serializedObject, "m_ShieldRegenerativeAmount"));
                EditorGUILayout.PropertyField(PropertyFromName(serializedObject, "m_ShieldRegenerativeWait"));
                EditorGUI.indentLevel--;
            }

            if ((m_DamageMultiplierFoldout = EditorGUILayout.Foldout(m_DamageMultiplierFoldout, "Damage Multiplier Options", InspectorUtility.BoldFoldout)))
            {
                EditorGUI.indentLevel++;
                if (m_DamageMultiplierList == null)
                {
                    var damageMultiplierProperty = PropertyFromName(serializedObject, "m_DamageMultipliers");
                    m_DamageMultiplierList = new ReorderableList(serializedObject, damageMultiplierProperty, true, true, true, true);
                    m_DamageMultiplierList.drawHeaderCallback  = OnDamageMultiplierHeaderDraw;
                    m_DamageMultiplierList.drawElementCallback = OnDamageMultiplierElementDraw;
                }
                // Indent the list so it lines up with the rest of the content.
                var rect = GUILayoutUtility.GetRect(0, m_DamageMultiplierList.GetHeight());
                rect.x    += EditorGUI.indentLevel * 15;
                rect.xMax -= EditorGUI.indentLevel * 15;
                m_DamageMultiplierList.DoList(rect);

                EditorGUI.indentLevel--;
            }

            if ((m_DeathFoldout = EditorGUILayout.Foldout(m_DeathFoldout, "Death Options", InspectorUtility.BoldFoldout)))
            {
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(PropertyFromName(serializedObject, "m_SpawnedObjectsOnDeath"), true);
                EditorGUILayout.PropertyField(PropertyFromName(serializedObject, "m_DestroyedObjectsOnDeath"), true);
                var deactivateOnDeath = PropertyFromName(serializedObject, "m_DeactivateOnDeath");
                EditorGUILayout.PropertyField(deactivateOnDeath);
                if (deactivateOnDeath.boolValue)
                {
                    EditorGUILayout.PropertyField(PropertyFromName(serializedObject, "m_DeactivateOnDeathDelay"));
                }
                var deathLayerProperty = PropertyFromName(serializedObject, "m_DeathLayer");
                deathLayerProperty.intValue = EditorGUILayout.LayerField("Death Layer", deathLayerProperty.intValue);
                EditorGUI.indentLevel--;
            }

            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(health, "Inspector");
                serializedObject.ApplyModifiedProperties();
                InspectorUtility.SetObjectDirty(health);
            }
        }
コード例 #4
0
        /// <summary>
        /// Builds the character.
        /// </summary>
        private void BuildCharacter()
        {
            if (!string.IsNullOrEmpty(AssetDatabase.GetAssetPath(m_Character)))
            {
                var name = m_Character.name;
                m_Character      = GameObject.Instantiate(m_Character) as GameObject;
                m_Character.name = name;
            }
            // Call a runtime component to build the character so the character can be built at runtime.
            var isNetworked = false;

#if !(UNITY_4_6 || UNITY_4_7 || UNITY_5_0)
            isNetworked = m_IsNetworked;
#endif
            var baseDirectory        = Path.GetDirectoryName(AssetDatabase.GetAssetPath(MonoScript.FromScriptableObject(this))).Replace("Editor/Builders", "");
            var maxFrictionMaterial  = AssetDatabase.LoadAssetAtPath(baseDirectory + "Demos/Shared/Physic Materials/MaxFriction.physicMaterial", typeof(PhysicMaterial)) as PhysicMaterial;
            var frictionlessMaterial = AssetDatabase.LoadAssetAtPath(baseDirectory + "Demos/Shared/Physic Materials/Frictionless.physicMaterial", typeof(PhysicMaterial)) as PhysicMaterial;
            if (m_ModelType == ModelType.Humanoid)
            {
                ThirdPersonController.CharacterBuilder.BuildHumanoidCharacter(m_Character, m_AIAgent, isNetworked, m_MovementType, m_AnimatorController, maxFrictionMaterial, frictionlessMaterial);
            }
            else
            {
                ThirdPersonController.CharacterBuilder.BuildCharacter(m_Character, m_AIAgent, isNetworked, m_MovementType, m_AnimatorController, maxFrictionMaterial, frictionlessMaterial, m_ItemTransforms, m_FootTransforms);
            }
            if (isNetworked)
            {
#if !ENABLE_MULTIPLAYER
                // The character is networked so enable the multiplayer symbol.
                RigidbodyCharacterControllerInspector.ToggleMultiplayerSymbol();
#endif
            }
            else
            {
#if ENABLE_MULTIPLAYER
                // The character isn't networked so disable the multiplayer symbol.
                RigidbodyCharacterControllerInspector.ToggleMultiplayerSymbol();
#endif
            }
            Selection.activeGameObject = m_Character;
            if (m_ModelType == ModelType.Humanoid)
            {
                // Add the Fall and Jump abilities.
                if (m_AddStandardAbilities)
                {
                    var controller = m_Character.GetComponent <RigidbodyCharacterController>();
                    AddAbility(controller, typeof(Opsive.ThirdPersonController.Wrappers.Abilities.Fall), "", Abilities.Ability.AbilityStartType.Automatic, Abilities.Ability.AbilityStopType.Manual);
                    AddAbility(controller, typeof(Opsive.ThirdPersonController.Wrappers.Abilities.Jump), "Jump", Abilities.Ability.AbilityStartType.ButtonDown, Abilities.Ability.AbilityStopType.Automatic);
                    AddAbility(controller, typeof(Opsive.ThirdPersonController.Wrappers.Abilities.SpeedChange), "Change Speeds", Abilities.Ability.AbilityStartType.ButtonDown, Abilities.Ability.AbilityStopType.ButtonUp);
                }

                // Open up the ragdoll builder. This class is internal to the Unity editor so reflection must be used to access it.
                if (m_AddRagdoll)
                {
                    AddRagdoll();
                }
            }

#if DEATHMATCH_AI_KIT_PRESENT
            // Open the Agent Builder.
            if (m_AIAgent && m_DeathmatchAgent)
            {
                DeathmatchAIKit.Editor.AgentBuilder.ShowWindow();
                var windows = Resources.FindObjectsOfTypeAll(typeof(DeathmatchAIKit.Editor.AgentBuilder));
                if (windows != null && windows.Length > 0)
                {
                    var agentBuilder = windows[0] as DeathmatchAIKit.Editor.AgentBuilder;
                    agentBuilder.Agent = m_Character;
                }
            }
#endif
            InspectorUtility.SetObjectDirty(m_Character);
            Close();
        }
コード例 #5
0
        /// <summary>
        /// Draws the specified CameraState.
        /// </summary>
        /// <param name="cameraState">The camera state to draw.</param>
        /// <param name="serializedObject">The SerializedObject of the CameraState.</param>
        /// <param name="forceShow">Should the state be force shown?</param>
        /// <returns>True if there were changes to the camera state.</returns>
        public static bool DrawCameraState(CameraState cameraState, SerializedObject serializedObject, bool forceShow)
        {
            EditorGUI.BeginChangeCheck();

            SerializedProperty applyState = null;

            if (!forceShow)
            {
                EditorGUILayout.PropertyField(serializedObject.FindProperty("m_Exclusive"));

                applyState = serializedObject.FindProperty("m_ApplyViewMode");
                EditorGUILayout.PropertyField(applyState);
            }
            if (forceShow || applyState.boolValue)
            {
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(serializedObject.FindProperty("m_ViewMode"));
                EditorGUI.indentLevel--;
            }

            if (cameraState.ViewMode != CameraMonitor.CameraViewMode.Pseudo3D && (m_LookFoldout = EditorGUILayout.Foldout(m_LookFoldout, "Look Options", InspectorUtility.BoldFoldout)))
            {
                EditorGUI.indentLevel++;
                if (!forceShow)
                {
                    applyState = serializedObject.FindProperty("m_ApplyPitchLimit");
                    EditorGUILayout.PropertyField(applyState);
                }
                if (forceShow || applyState.boolValue)
                {
                    EditorGUI.indentLevel++;
                    var minPitchProperty = serializedObject.FindProperty("m_MinPitchLimit");
                    var maxPitchProperty = serializedObject.FindProperty("m_MaxPitchLimit");
                    var minValue         = Mathf.Round(minPitchProperty.floatValue * 100f) / 100f;
                    var maxValue         = Mathf.Round(maxPitchProperty.floatValue * 100f) / 100f;
                    InspectorUtility.DrawMinMaxLabeledFloatSlider("Pitch Limit", ref minValue, ref maxValue,
                                                                  (cameraState.ViewMode == CameraMonitor.CameraViewMode.ThirdPerson || cameraState.ViewMode == CameraMonitor.CameraViewMode.RPG) ? -90 : 0, 90);
                    minPitchProperty.floatValue = minValue;
                    maxPitchProperty.floatValue = maxValue;
                    EditorGUI.indentLevel--;
                }

                // Cover yaw limits are only applicable to the third person view.
                if (cameraState.ViewMode == CameraMonitor.CameraViewMode.ThirdPerson || cameraState.ViewMode == CameraMonitor.CameraViewMode.RPG)
                {
                    if (!forceShow)
                    {
                        applyState = serializedObject.FindProperty("m_ApplyYawLimit");
                        EditorGUILayout.PropertyField(applyState);
                    }
                    if (forceShow || applyState.boolValue)
                    {
                        EditorGUI.indentLevel++;
                        var minYawProperty = serializedObject.FindProperty("m_MinYawLimit");
                        var maxYawProperty = serializedObject.FindProperty("m_MaxYawLimit");
                        var minValue       = Mathf.Round(minYawProperty.floatValue * 100f) / 100f;
                        var maxValue       = Mathf.Round(maxYawProperty.floatValue * 100f) / 100f;
                        InspectorUtility.DrawMinMaxLabeledFloatSlider("Yaw Limit", ref minValue, ref maxValue, -180, 180);
                        minYawProperty.floatValue = minValue;
                        maxYawProperty.floatValue = maxValue;
                        EditorGUI.indentLevel--;
                    }
                }

                if (!forceShow)
                {
                    applyState = serializedObject.FindProperty("m_ApplyIgnoreLayerMask");
                    EditorGUILayout.PropertyField(applyState);
                }
                if (forceShow || applyState.boolValue)
                {
                    EditorGUI.indentLevel++;
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("m_IgnoreLayerMask"));
                    EditorGUI.indentLevel--;
                }
                EditorGUI.indentLevel--;
            }

            if ((m_MovementFoldout = EditorGUILayout.Foldout(m_MovementFoldout, "Movement Options", InspectorUtility.BoldFoldout)))
            {
                EditorGUI.indentLevel++;
                if (!forceShow)
                {
                    applyState = serializedObject.FindProperty("m_ApplyMoveSmoothing");
                    EditorGUILayout.PropertyField(applyState);
                }
                if (forceShow || applyState.boolValue)
                {
                    EditorGUI.indentLevel++;
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("m_MoveSmoothing"));
                    EditorGUI.indentLevel--;
                }
                if (!forceShow)
                {
                    applyState = serializedObject.FindProperty("m_ApplyCameraOffset");
                    EditorGUILayout.PropertyField(applyState);
                }
                if (forceShow || applyState.boolValue)
                {
                    EditorGUI.indentLevel++;
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("m_CameraOffset"), true);
                    EditorGUI.indentLevel--;
                }
                // The following properties are only applicable to the third person view.
                if (cameraState.ViewMode == CameraMonitor.CameraViewMode.ThirdPerson || cameraState.ViewMode == CameraMonitor.CameraViewMode.RPG)
                {
                    if (!forceShow)
                    {
                        applyState = serializedObject.FindProperty("m_ApplySmartPivot");
                        EditorGUILayout.PropertyField(applyState);
                    }
                    if (forceShow || applyState.boolValue)
                    {
                        EditorGUI.indentLevel++;
                        EditorGUILayout.PropertyField(serializedObject.FindProperty("m_SmartPivot"), true);
                        EditorGUI.indentLevel--;
                    }
                    if (!forceShow)
                    {
                        applyState = serializedObject.FindProperty("m_ApplyFieldOfView");
                        EditorGUILayout.PropertyField(applyState);
                    }
                    if (forceShow || applyState.boolValue)
                    {
                        EditorGUI.indentLevel++;
                        EditorGUILayout.PropertyField(serializedObject.FindProperty("m_FieldOfView"));
                        EditorGUILayout.PropertyField(serializedObject.FindProperty("m_FieldOfViewSpeed"));
                        EditorGUI.indentLevel--;
                    }
                    if (!forceShow)
                    {
                        applyState = serializedObject.FindProperty("m_ApplyTurn");
                        EditorGUILayout.PropertyField(applyState);
                    }
                    if (forceShow || applyState.boolValue)
                    {
                        EditorGUI.indentLevel++;
                        EditorGUILayout.PropertyField(serializedObject.FindProperty("m_TurnSmoothing"));
                        EditorGUILayout.PropertyField(serializedObject.FindProperty("m_TurnSpeed"));
                        EditorGUI.indentLevel--;
                    }
                    if (!forceShow)
                    {
                        applyState = serializedObject.FindProperty("m_ApplyStepZoom");
                        EditorGUILayout.PropertyField(applyState);
                    }
                    if (forceShow || applyState.boolValue)
                    {
                        EditorGUI.indentLevel++;
                        EditorGUILayout.PropertyField(serializedObject.FindProperty("m_StepZoomSensitivity"));
                        EditorGUILayout.PropertyField(serializedObject.FindProperty("m_MinStepZoom"));
                        EditorGUILayout.PropertyField(serializedObject.FindProperty("m_MaxStepZoom"));
                        EditorGUI.indentLevel--;
                    }
                }
                else
                {
                    if (!forceShow)
                    {
                        applyState = serializedObject.FindProperty("m_ApplyRotationSpeed");
                        EditorGUILayout.PropertyField(applyState);
                    }
                    if (forceShow || applyState.boolValue)
                    {
                        EditorGUI.indentLevel++;
                        EditorGUILayout.PropertyField(serializedObject.FindProperty("m_RotationSpeed"));
                        EditorGUI.indentLevel--;
                    }
                    if (!forceShow)
                    {
                        applyState = serializedObject.FindProperty("m_ApplyView");
                        EditorGUILayout.PropertyField(applyState);
                    }
                    if (forceShow || applyState.boolValue)
                    {
                        EditorGUI.indentLevel++;
                        EditorGUILayout.PropertyField(serializedObject.FindProperty("m_ViewDistance"));
                        EditorGUILayout.PropertyField(serializedObject.FindProperty("m_ViewStep"));
                        if (cameraState.ViewMode == CameraMonitor.CameraViewMode.Pseudo3D)
                        {
                            EditorGUILayout.PropertyField(serializedObject.FindProperty("m_LookDirection"));
                        }
                        EditorGUI.indentLevel--;
                    }
                }
                if (cameraState.ViewMode != CameraMonitor.CameraViewMode.Pseudo3D)
                {
                    if (!forceShow)
                    {
                        applyState = serializedObject.FindProperty("m_ApplyCollisionRadius");
                        EditorGUILayout.PropertyField(applyState);
                    }
                    if (forceShow || applyState.boolValue)
                    {
                        EditorGUI.indentLevel++;
                        EditorGUILayout.PropertyField(serializedObject.FindProperty("m_CollisionRadius"));
                        EditorGUI.indentLevel--;
                    }
                }
                EditorGUI.indentLevel--;
            }

            if ((cameraState.ViewMode == CameraMonitor.CameraViewMode.ThirdPerson || cameraState.ViewMode == CameraMonitor.CameraViewMode.RPG) &&
                (m_CharacterFadeFoldout = EditorGUILayout.Foldout(m_CharacterFadeFoldout, "Character Fade Options", InspectorUtility.BoldFoldout)))
            {
                EditorGUI.indentLevel++;
                if (!forceShow)
                {
                    applyState = serializedObject.FindProperty("m_ApplyFadeCharacter");
                    EditorGUILayout.PropertyField(applyState);
                }
                if (forceShow || applyState.boolValue)
                {
                    EditorGUI.indentLevel++;
                    var fade = serializedObject.FindProperty("m_FadeCharacter");
                    EditorGUILayout.PropertyField(fade);
                    if (fade.boolValue)
                    {
                        EditorGUILayout.PropertyField(serializedObject.FindProperty("m_StartFadeDistance"));
                        EditorGUILayout.PropertyField(serializedObject.FindProperty("m_EndFadeDistance"));
                    }
                    EditorGUI.indentLevel--;
                }
                EditorGUI.indentLevel--;
            }

            // The following properties are only applicable to the third person view.
            if (cameraState.ViewMode == CameraMonitor.CameraViewMode.ThirdPerson || cameraState.ViewMode == CameraMonitor.CameraViewMode.RPG)
            {
                if ((m_TargetLock = EditorGUILayout.Foldout(m_TargetLock, "Target Lock Options", InspectorUtility.BoldFoldout)))
                {
                    EditorGUI.indentLevel++;
                    if (!forceShow)
                    {
                        applyState = serializedObject.FindProperty("m_ApplyTargetLock");
                        EditorGUILayout.PropertyField(applyState);
                    }
                    if (forceShow || applyState.boolValue)
                    {
                        EditorGUI.indentLevel++;
                        var useTargetLock = serializedObject.FindProperty("m_UseTargetLock");
                        EditorGUILayout.PropertyField(useTargetLock);
                        if (useTargetLock.boolValue)
                        {
                            EditorGUILayout.PropertyField(serializedObject.FindProperty("m_TargetLockSpeed"));
                            EditorGUILayout.PropertyField(serializedObject.FindProperty("m_BreakForce"));
                            var useHumanoidTargetLock = serializedObject.FindProperty("m_UseHumanoidTargetLock");
                            EditorGUILayout.PropertyField(useHumanoidTargetLock);
                            if (useHumanoidTargetLock.boolValue)
                            {
                                EditorGUILayout.PropertyField(serializedObject.FindProperty("m_HumanoidTargetLockBone"));
                            }
                        }
                        EditorGUI.indentLevel--;
                    }
                    EditorGUI.indentLevel--;
                }

                if ((m_RecoilFoldout = EditorGUILayout.Foldout(m_RecoilFoldout, "Recoil Options", InspectorUtility.BoldFoldout)))
                {
                    EditorGUI.indentLevel++;
                    if (!forceShow)
                    {
                        applyState = serializedObject.FindProperty("m_ApplyRecoil");
                        EditorGUILayout.PropertyField(applyState);
                    }
                    if (forceShow || applyState.boolValue)
                    {
                        EditorGUI.indentLevel++;
                        EditorGUILayout.PropertyField(serializedObject.FindProperty("m_RecoilSpring"));
                        EditorGUILayout.PropertyField(serializedObject.FindProperty("m_RecoilDampening"));
                        EditorGUI.indentLevel--;
                    }
                    EditorGUI.indentLevel--;
                }

                if ((m_RestrictionsFoldout = EditorGUILayout.Foldout(m_RestrictionsFoldout, "Restrictions Options", InspectorUtility.BoldFoldout)))
                {
                    EditorGUI.indentLevel++;
                    if (!forceShow)
                    {
                        applyState = serializedObject.FindProperty("m_ApplyObstructionCheck");
                        EditorGUILayout.PropertyField(applyState);
                    }
                    if (forceShow || applyState.boolValue)
                    {
                        EditorGUI.indentLevel++;
                        EditorGUILayout.PropertyField(serializedObject.FindProperty("m_ObstructionCheck"));
                        EditorGUI.indentLevel--;
                    }
                    if (!forceShow)
                    {
                        applyState = serializedObject.FindProperty("m_ApplyStaticHeight");
                        EditorGUILayout.PropertyField(applyState);
                    }
                    if (forceShow || applyState.boolValue)
                    {
                        EditorGUI.indentLevel++;
                        EditorGUILayout.PropertyField(serializedObject.FindProperty("m_StaticHeight"));
                        EditorGUI.indentLevel--;
                    }
                    if (!forceShow)
                    {
                        applyState = serializedObject.FindProperty("m_ApplyVerticalOffset");
                        EditorGUILayout.PropertyField(applyState);
                    }
                    if (forceShow || applyState.boolValue)
                    {
                        EditorGUI.indentLevel++;
                        EditorGUILayout.PropertyField(serializedObject.FindProperty("m_VerticalOffset"));
                        EditorGUI.indentLevel--;
                    }
                    EditorGUI.indentLevel--;
                }
            }
            return(EditorGUI.EndChangeCheck());
        }