123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- using UnityEngine;
- public class Lines : MonoBehaviour
- {
- [SerializeField]
- private Transform posA1;
- [SerializeField]
- private Transform posB1;
- [SerializeField]
- private Transform posA2;
- [SerializeField]
- private Transform posB2;
- [SerializeField]
- private Transform posA3;
- [SerializeField]
- private Transform posB3;
- [SerializeField]
- private Transform posA4;
- [SerializeField]
- private Transform posB4;
- [SerializeField]
- private Transform posA5;
- [SerializeField]
- private Transform posB5;
- [SerializeField]
- private LineRenderer line_1;
- [SerializeField]
- private LineRenderer line_2;
- [SerializeField]
- private LineRenderer line_3;
- [SerializeField]
- private LineRenderer line_4;
- [SerializeField]
- private LineRenderer line_5;
- private void Start()
- {
- line_1.positionCount = 2;
- line_2.positionCount = 2;
- line_3.positionCount = 2;
- line_4.positionCount = 2;
- line_5.positionCount = 2;
- }
- void Update()
- {
- line_1.SetPosition(0, posA1.position);
- line_1.SetPosition(1, posB1.position);
- line_2.SetPosition(0, posA2.position);
- line_2.SetPosition(1, posB2.position);
- line_3.SetPosition(0, posA3.position);
- line_3.SetPosition(1, posB3.position);
- line_4.SetPosition(0, posA4.position);
- line_4.SetPosition(1, posB4.position);
- line_5.SetPosition(0, posA5.position);
- line_5.SetPosition(1, posB5.position);
- }
- }
|