浏览代码

Deleted unnecessary spacing

/main
GitHub 4 年前
当前提交
a046c18a
共有 1 个文件被更改,包括 0 次插入12 次删除
  1. 12
      UOP1_Project/Assets/Scripts/Characters/Character.cs

12
UOP1_Project/Assets/Scripts/Characters/Character.cs


private void Awake()
{
characterController = GetComponent<CharacterController>();
//Raises the multiplier to how much gravity will affect vertical movement when in mid-air
//This is 0f at the beginning of a jump and will raise to maximum 1f
if (!characterController.isGrounded)

//Calculate the final verticalMovement
if (!characterController.isGrounded)
{
//Less control in mid-air, conserving momentum from previous frame
movementVector = inputVector * speed;

{
//Full speed ground movement
movementVector = inputVector * speed;
//Resets the verticalMovement while on the ground,
//so that regardless of whether the player landed from a high fall or not,
//if they drop off a platform they will always start with the same verticalMovement.

movementVector.x += (1f - hitNormal.y) * hitNormal.x * (speed - slideFriction);
movementVector.z += (1f - hitNormal.y) * hitNormal.z * (speed - slideFriction);
}
//Apply the result and move the character in space
movementVector.y = verticalMovement;
characterController.Move(movementVector * Time.deltaTime);

{
// Stopping any upwards movement
// and having the player fall back down
verticalMovement = 0f;
}
}

{
isJumping = false; //This will stop the reduction to the gravity, which will then quickly pull down the character
}
}
正在加载...
取消
保存