Aucune description
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

Snapping.cs 520B

123456789101112131415161718192021
  1. using UnityEngine;
  2. using UnityEditor;
  3. namespace UnityEditor.U2D.Common.Path
  4. {
  5. internal class Snapping : ISnapping<Vector3>
  6. {
  7. public Vector3 Snap(Vector3 position)
  8. {
  9. return new Vector3(
  10. Snap(position.x, EditorSnapSettings.move.x),
  11. Snap(position.y, EditorSnapSettings.move.y),
  12. position.z);
  13. }
  14. private float Snap(float value, float snap)
  15. {
  16. return Mathf.Round(value / snap) * snap;
  17. }
  18. }
  19. }