/// <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];
            }

            // Walk speed
            if (movementData[SpeedIndex] == null)
            {
                movementData[SpeedIndex] = new MovementVariable();
            }
            movementData[SpeedIndex].FloatValue = EditorGUILayout.FloatField(new GUIContent("Speed", "How fast the character walks."), movementData[SpeedIndex].FloatValue);
            if (movementData[SpeedIndex].FloatValue < 0)
            {
                movementData[SpeedIndex].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);


            return(movementData);
        }
Esempio n. 2
0
 /// <summary>
 /// Initialise the movement with the given movement data.
 /// </summary>
 /// <param name="character">Character.</param>
 /// <param name="movementData">Movement data.</param>
 override public Movement Init(Character character, MovementVariable[] movementData)
 {
     base.Init(character, movementData);
     crouchMovement = character.GetComponentInChildren <GroundMovement_Crouch> ();
     if (crouchMovement == null)
     {
         Debug.LogWarning("Couldn't find a crouch movement, crouch jump will be disabled.");
         Enabled = false;
     }
     return(this);
 }
Esempio n. 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];
            }

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

            // Start crouch only by pressing down
            if (movementData[CrouchStartMustBeDownIndex] == null)
            {
                movementData[CrouchStartMustBeDownIndex] = new MovementVariable();
            }
            movementData[CrouchStartMustBeDownIndex].BoolValue = EditorGUILayout.Toggle(new GUIContent("Start Crouch With Down", "If true the character can only start the crouch when pressing directly down, not diagonally down."), movementData[CrouchStartMustBeDownIndex].BoolValue);

            return(movementData);
        }
Esempio n. 4
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);
        }
 /// <summary>
 /// Initialise this instance.
 /// </summary>
 public override Movement Init(Character character)
 {
     base.Init (character);
     crouchMovement = character.GetComponentInChildren<GroundMovement_Crouch> ();
     if (crouchMovement == null)
     {
         Debug.LogWarning ("Couldn't find a crouch movement, crouch jump will be disabled.");
         Enabled = false;
     }
     return this;
 }