maint: various clean-ups
This commit is contained in:
@@ -8,12 +8,17 @@ namespace NodeCanvas.Tasks.Actions {
|
||||
[Category("Reset/Movement")]
|
||||
[Description("Unit flat ground movement")]
|
||||
public class CalculateGroundedLocomotion : ActionTask<CharacterController>{
|
||||
public BBParameter<float> baseMoveSpeed;
|
||||
public BBParameter<float> sprintAdditionalSpeed;
|
||||
|
||||
public BBParameter<float> moveSpeed;
|
||||
|
||||
|
||||
public BBParameter<Vector3> moveDirection;
|
||||
|
||||
protected override string info {
|
||||
get{
|
||||
return string.Format($"<b>Set ground movement</b>, <i>{moveSpeed.value}</i> speed");
|
||||
}
|
||||
}
|
||||
|
||||
private float sprintPower;
|
||||
private bool sprinting;
|
||||
|
||||
@@ -45,18 +50,8 @@ namespace NodeCanvas.Tasks.Actions {
|
||||
float outputSpeed = 0f;
|
||||
|
||||
// Add base speed
|
||||
outputSpeed += baseMoveSpeed.value;
|
||||
|
||||
// Add sprinting speed
|
||||
// TODO: Take this sprinting section out and move it into it's own task. Sprinting should be a state in the ground locomotion graph.
|
||||
if (sprinting) {
|
||||
sprintPower = Mathf.Lerp(sprintPower, 1, sprintAdditionalSpeed.value * Time.deltaTime);
|
||||
outputSpeed += (sprintAdditionalSpeed.value * sprintPower);
|
||||
} else {
|
||||
outputSpeed += (sprintAdditionalSpeed.value * sprintPower);
|
||||
sprintPower = Mathf.Lerp(sprintPower, 0, sprintAdditionalSpeed.value * Time.deltaTime);
|
||||
}
|
||||
|
||||
outputSpeed += moveSpeed.value;
|
||||
|
||||
return outputSpeed;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user