Beispiel #1
0
 public void CreateBezier(List <Vector3> points)
 {
     if (points != null)
     {
         pathCreator                        = GetComponent <PathCreator>();
         pathCreator.bezierPath             = new BezierPath(points, true, PathSpace.xz);
         pathCreator.bezierPath.controlMode = BezierPath.ControlMode.Free;
     }
     pathPlacer.Generate();
 }
    void Update()
    {
        timer += Time.deltaTime;

        if (!PathFollower.Isstart)
        {
            return;
        }


        if (Input.GetMouseButtonDown(0) && EventSystem.current.currentSelectedGameObject == null)
        {
            dir *= -1;
        }

        transform.localPosition = Vector3.Lerp(transform.localPosition, new Vector3(transform.localPosition.x, 0.5f * dir, transform.localPosition.z), Time.deltaTime * 10);

        if (pointsList.Count != 0 && timer > pointsList.Peek() - 4 + beforeStartTime)
        {
            if (counter < pointsCount)
            {
                counter++;
                pointsList.Dequeue();
            }
            else
            {
                pathPlacer.Generate(pointsList.Peek() * 10 - 1 + beforeStartTime * 10 + 100);
                pointsList.Dequeue();

                UpdateProgressBar();

                counter = 0;
            }

            if (pointsList.Count == 0)
            {
                timer = 0;
                StartCoroutine(Counter());
            }
        }
    }