LineInScene.cs 739 B

12345678910111213141516171819202122232425262728293031
  1. using System;
  2. using UnityEngine;
  3. [AddComponentMenu("FantaBlade/Add A Line In Scene")]
  4. public class LineInScene : MonoBehaviour
  5. {
  6. private void OnDrawGizmos()
  7. {
  8. if (this.show)
  9. {
  10. Vector3 start = this.offset + base.transform.position;
  11. Vector3 end = this.offset + base.transform.position + new Vector3(this.length * Mathf.Cos(0.0174532924f * this.angle), this.length * Mathf.Sin(0.0174532924f * this.angle));
  12. UnityEngine.Debug.DrawLine(start, end, this.color);
  13. }
  14. }
  15. [SerializeField]
  16. public bool show = true;
  17. [SerializeField]
  18. public float length = 1f;
  19. [SerializeField]
  20. public Color color = Color.cyan;
  21. [SerializeField]
  22. public Vector3 offset;
  23. [SerializeField]
  24. public float angle;
  25. }