Exemplo n.º 1
0
    public Vector3 GetMovementPoint(float ratio)
    {
        int     index = 0;
        Vector2 a     = Movement.GetPoint01(ratio, out index);
        Vector3 fin   = new Vector3(a.x, a.y, Seat[0].Object.transform.position.z);

        return(fin);
    }
Exemplo n.º 2
0
    IEnumerator Start()
    {
        var splinePoints = new List <Vector2>();
        var i            = 1;
        var obj          = GameObject.Find("Sphere" + (i++));

        while (obj != null)
        {
            splinePoints.Add(Camera.main.WorldToScreenPoint(obj.transform.position));
            obj = GameObject.Find("Sphere" + (i++));
        }

        var line = new VectorLine("Spline", new List <Vector2>(segments + 1), 2.0f, LineType.Continuous);

        line.MakeSpline(splinePoints.ToArray(), segments, loop);
        line.Draw();

        // Make the cube "ride" the spline at a constant speed
        do
        {
            for (var dist = 0.0f; dist < 1.0f; dist += Time.deltaTime * speed)
            {
                var splinePoint = line.GetPoint01(dist);
                cube.position = Camera.main.ScreenToWorldPoint(new Vector3(splinePoint.x, splinePoint.y, 10.0f));
                yield return(null);
            }
        } while (loop);
    }
Exemplo n.º 3
0
    // Token: 0x06000B67 RID: 2919 RVA: 0x00034550 File Offset: 0x00032950
    private IEnumerator Start()
    {
        List <Vector2> splinePoints = new List <Vector2>();
        int            i            = 1;
        var            arg          = "Sphere";
        int            num;

        i = (num = i) + 1;
        GameObject obj = GameObject.Find(arg + num);

        while (obj != null)
        {
            splinePoints.Add(Camera.main.WorldToScreenPoint(obj.transform.position));
            var arg2 = "Sphere";
            i   = (num = i) + 1;
            obj = GameObject.Find(arg2 + num);
        }
        VectorLine line = new VectorLine("Spline", new List <Vector2>(this.segments + 1), 2f, LineType.Continuous);

        line.MakeSpline(splinePoints.ToArray(), this.segments, this.loop);
        line.Draw();
        do
        {
            for (float dist = 0f; dist < 1f; dist += Time.deltaTime * this.speed)
            {
                Vector2 splinePoint = line.GetPoint01(dist);
                this.cube.position = Camera.main.ScreenToWorldPoint(new Vector3(splinePoint.x, splinePoint.y, 10f));
                yield return(null);
            }
        }while (this.loop);
        yield break;
    }