private void Accelerate(out Vector2 newVelocity) { Vector2 shouldVel = transform.up * Speed; newVelocity = AccelerationCalculator.Vector(Rigidbody.velocity, shouldVel, Accel); Quaternion needRot = InDirectionRotator.Rotate(CurrentDirection); transform.rotation = StraightQuaternionSwitcher.Get(transform.rotation, needRot, BodyRotateSpeed * Time.fixedDeltaTime); IsAccelerating = false; IsDiagonalMove = false; }
private void Decelerate(out Vector2 newVelocity) { newVelocity = AccelerationCalculator.Vector(Rigidbody.velocity, Vector2.zero, Decel); }