Lines.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. using UnityEngine;
  2. public class Lines : MonoBehaviour
  3. {
  4. [SerializeField]
  5. private Transform posA1;
  6. [SerializeField]
  7. private Transform posB1;
  8. [SerializeField]
  9. private Transform posA2;
  10. [SerializeField]
  11. private Transform posB2;
  12. [SerializeField]
  13. private Transform posA3;
  14. [SerializeField]
  15. private Transform posB3;
  16. [SerializeField]
  17. private Transform posA4;
  18. [SerializeField]
  19. private Transform posB4;
  20. [SerializeField]
  21. private Transform posA5;
  22. [SerializeField]
  23. private Transform posB5;
  24. [SerializeField]
  25. private LineRenderer line_1;
  26. [SerializeField]
  27. private LineRenderer line_2;
  28. [SerializeField]
  29. private LineRenderer line_3;
  30. [SerializeField]
  31. private LineRenderer line_4;
  32. [SerializeField]
  33. private LineRenderer line_5;
  34. private void Start()
  35. {
  36. line_1.positionCount = 2;
  37. line_2.positionCount = 2;
  38. line_3.positionCount = 2;
  39. line_4.positionCount = 2;
  40. line_5.positionCount = 2;
  41. }
  42. void Update()
  43. {
  44. line_1.SetPosition(0, posA1.position);
  45. line_1.SetPosition(1, posB1.position);
  46. line_2.SetPosition(0, posA2.position);
  47. line_2.SetPosition(1, posB2.position);
  48. line_3.SetPosition(0, posA3.position);
  49. line_3.SetPosition(1, posB3.position);
  50. line_4.SetPosition(0, posA4.position);
  51. line_4.SetPosition(1, posB4.position);
  52. line_5.SetPosition(0, posA5.position);
  53. line_5.SetPosition(1, posB5.position);
  54. }
  55. }