Projekt

Obecné

Profil

Stáhnout (1.06 KB) Statistiky
| Větev: | Tag: | Revize:
1
using UnityEngine;
2

    
3
namespace DeltaRobotVr.Components
4
{
5
    public class Curve : MonoBehaviour
6
    {
7
        private long _currentCounter;
8
        private LineRenderer _lineRenderer;
9
        
10
        void Start()
11
        {
12
            _currentCounter = Client.Instance.CurveCounter;
13
            _lineRenderer = GetComponent<LineRenderer>();
14

    
15
            // Set curve color
16
            var color = UnityEngine.Color.yellow;
17
            var cs = ConfigurationProvider.Instance.CurveColorHex;
18
            ColorUtility.TryParseHtmlString(cs, out color);
19

    
20
            _lineRenderer.material.color = color;
21
        }
22

    
23
        void Update()
24
        {
25
            if (Client.Instance.IsConnected)
26
            {
27
                var counter = Client.Instance.CurveCounter;
28
                if(counter != _currentCounter && Client.Instance.Curve != null)
29
                {
30
                    _lineRenderer.positionCount = Client.Instance.Curve.Length;
31
                    _lineRenderer.SetPositions(Single3Utils.ToVector3(Client.Instance.Curve));
32
                }
33
            }
34
        }
35
    }
36
}
(7-7/12)