public override void updateMovement(CharacterMovement movement) { animator.SetFloat("moveAmount", movement.moveAmount); Vector3 desiredMoveDirection = (movement.position - transform.position).normalized; desiredMoveDirection.y = 0f; if (desiredMoveDirection == Vector3.zero) { desiredMoveDirection = transform.forward; } transform.rotation = Quaternion.LookRotation(desiredMoveDirection); this.movement = movement; }
public virtual void updateMovement(CharacterMovement movement) { animator.SetFloat("moveAmount", movement.moveAmount); Vector3 desiredMoveDirection = movement.direction; desiredMoveDirection.y = 0f; if (desiredMoveDirection == Vector3.zero) { desiredMoveDirection = transform.forward; } Quaternion lookAngle = Quaternion.LookRotation(desiredMoveDirection); transform.rotation = Quaternion.RotateTowards(transform.rotation, lookAngle, rotationSpeed); this.movement = movement; }
public static void deserialize(byte[] data, ref Int32 offset, out CharacterMovement value) { deserialize(data, ref offset, out value.moveAmount); deserialize(data, ref offset, out value.direction); deserialize(data, ref offset, out value.position); }
public static void serialize(MemoryStream stream, CharacterMovement value) { serialize(stream, value.moveAmount); serialize(stream, value.direction); serialize(stream, value.position); }