/// <summary> /// Draws the inspector. /// </summary> public static MovementVariable[] DrawInspector(MovementVariable[] movementData, ref bool showDetails, Character target) { if (movementData == null || movementData.Length < MovementVariableCount) { movementData = new MovementVariable[MovementVariableCount]; } if (movementData[FloatGravityIndex] == null) { movementData[FloatGravityIndex] = new MovementVariable(DefaultFloatGravity); } movementData[FloatGravityIndex].FloatValue = EditorGUILayout.FloatField(new GUIContent("Float Gravity", "Gravity to apply while floating."), movementData[FloatGravityIndex].FloatValue); if (movementData[FloatGravityIndex].FloatValue > 0) { movementData[FloatGravityIndex].FloatValue = 0.0f; } return(movementData); }
/// <summary> /// Draws the inspector. /// </summary> public static MovementVariable[] DrawInspector(MovementVariable[] movementData, ref bool showDetails, Character target) { if (movementData == null || movementData.Length < MovementVariableCount) { movementData = new MovementVariable[MovementVariableCount]; } if (movementData[FloatGravityIndex] == null) movementData[FloatGravityIndex] = new MovementVariable(DefaultFloatGravity); movementData[FloatGravityIndex].FloatValue = EditorGUILayout.FloatField(new GUIContent("Float Gravity", "Gravity to apply while floating."), movementData[FloatGravityIndex].FloatValue); if (movementData[FloatGravityIndex].FloatValue > 0) movementData[FloatGravityIndex].FloatValue = 0.0f; return movementData; }
/// <summary> /// Initialise the movement with the given movement data. /// </summary> /// <param name="character">Character.</param> /// <param name="movementData">Movement data.</param> public override Movement Init(Character character, MovementVariable[] movementData) { this.character = character; // Set variables if (movementData != null && movementData.Length >= MovementVariableCount) { floatGravity = movementData[FloatGravityIndex].FloatValue; } else { Debug.LogError("Invalid movement data."); } return this; }