Exemple #1
0
        /// <summary>
        /// Draws the inspector.
        /// </summary>
        new public static MovementVariable[] DrawInspector(MovementVariable[] movementData, ref bool showDetails, Character target)
        {
            if (movementData == null || movementData.Length < MovementVariableCount)
            {
                movementData = new MovementVariable[MovementVariableCount];
            }

            // Draw base inspector and copy values
            MovementVariable[] baseMovementData = GroundMovement_Physics.DrawInspector(movementData, ref showDetails, target);
            System.Array.Copy(baseMovementData, movementData, baseMovementData.Length);

            if (showDetails)
            {
                // Loop Speed
                if (movementData[LoopSpeedIndex] == null)
                {
                    movementData[LoopSpeedIndex] = new MovementVariable(DefaultLoopSpeed);
                }
                movementData[LoopSpeedIndex].FloatValue = EditorGUILayout.FloatField(new GUIContent("Loop Speed", "Speed required to be able to run the loop."), movementData[LoopSpeedIndex].FloatValue);
                if (movementData[LoopSpeedIndex].FloatValue < 0)
                {
                    movementData[LoopSpeedIndex].FloatValue = 0;
                }

                // Slide Time
                if (movementData[SlideTimeIndex] == null)
                {
                    movementData[SlideTimeIndex] = new MovementVariable(DefaultSlideTime);
                }
                movementData[SlideTimeIndex].FloatValue = EditorGUILayout.FloatField(new GUIContent("SlideTime", "How long will the character slide down a slope if they get to 90 degrees without required speed."), movementData[SlideTimeIndex].FloatValue);
                if (movementData[SlideTimeIndex].FloatValue < 0)
                {
                    movementData[SlideTimeIndex].FloatValue = 0;
                }
            }

            // Not rotate warning
            if (!target.rotateToSlopes)
            {
                EditorGUILayout.HelpBox("A character with a Loop movement must use rotate to slopes.", MessageType.Error);
            }
            else if (target.maxSlopeRotation < 90)
            {
                EditorGUILayout.HelpBox("If your character cannot rotate to an angle of 90 degrees you don't need a Loop movement.", MessageType.Warning);
            }
            if (!target.rotateToSlopes || target.maxSlopeRotation < 90)
            {
                GUILayout.BeginHorizontal();
                GUILayout.FlexibleSpace();
                if (GUILayout.Button("Fix Now"))
                {
                    target.rotateToSlopes   = true;
                    target.maxSlopeRotation = 180;
                }
                GUILayout.EndHorizontal();
            }


            return(movementData);
        }
Exemple #2
0
        /// <summary>
        /// Draws the inspector.
        /// </summary>
        new public static MovementVariable[] DrawInspector(MovementVariable[] movementData, ref bool showDetails, Character target)
        {
            if (movementData == null || movementData.Length < MovementVariableCount)
            {
                movementData = new MovementVariable[MovementVariableCount];
            }

            // Draw base inspector and copy values
            MovementVariable[] baseMovementData = GroundMovement_Physics.DrawInspector(movementData, ref showDetails, target);
            System.Array.Copy(baseMovementData, movementData, baseMovementData.Length);


            return(movementData);
        }
Exemple #3
0
        /// <summary>
        /// Draws the inspector.
        /// </summary>
        new public static MovementVariable[] DrawInspector(MovementVariable[] movementData, ref bool showDetails, Character target)
        {
            if (movementData == null || movementData.Length < MovementVariableCount)
            {
                movementData = new MovementVariable[MovementVariableCount];
            }

            // Start crouch only by pressing down
            if (movementData[MinimumSpeedForSlideIndex] == null)
            {
                movementData[MinimumSpeedForSlideIndex] = new MovementVariable(DefaultMinimumSpeedForSlide);
            }
            movementData[MinimumSpeedForSlideIndex].FloatValue = EditorGUILayout.FloatField(new GUIContent("Minimum Speed for Slide", "How fast does the character have to go before they will go in to crouch slide instead of just crouching?"), movementData[MinimumSpeedForSlideIndex].FloatValue);
            if (movementData[MinimumSpeedForSlideIndex].FloatValue < 0)
            {
                movementData[MinimumSpeedForSlideIndex].FloatValue = 0.0f;
            }

            // Max Speed
            if (movementData[MaxSpeedIndex] == null)
            {
                movementData[MaxSpeedIndex] = new MovementVariable();
            }
            movementData[MaxSpeedIndex].FloatValue = EditorGUILayout.FloatField(new GUIContent("Maximum Speed", "The characters peak speed, required as we may accelerate down a hill."), movementData[MaxSpeedIndex].FloatValue);
            if (movementData[MaxSpeedIndex].FloatValue < 0)
            {
                movementData[MaxSpeedIndex].FloatValue = 0.0f;
            }

            // Draw base inspector and copy values
            MovementVariable[] baseMovementData = GroundMovement_Crouch.DrawInspector(movementData, ref showDetails, target);
            System.Array.Copy(baseMovementData, movementData, baseMovementData.Length);

            GroundMovement_Physics.DrawStandardPhysicsSettings(movementData, PhysicsMovementDataIndexOffset, showDetails);

            return(movementData);
        }