Exemplo n.º 1
0
    override public void RemakePath()
    {
        leftpath = new PathSpline();
        Transform leftpathobj = transform.Find("LeftPath");

        for (int i = 0; i < leftpathobj.childCount; i++)
        {
            Transform child   = leftpathobj.Find("p" + i);
            PathNode  newnode = new PathNode(child.position.x, child.position.z, child.position.y);
            leftpath.AddNode(newnode);
        }

        middlepath = new PathSpline();
        Transform middlepathobj = transform.Find("MiddlePath");

        for (int i = 0; i < middlepathobj.childCount; i++)
        {
            Transform child   = middlepathobj.Find("p" + i);
            PathNode  newnode = new PathNode(child.position.x, child.position.z, child.position.y);
            middlepath.AddNode(newnode);
        }


        rightpath = new PathSpline();
        Transform rightpathobj = transform.Find("RightPath");

        for (int i = 0; i < rightpathobj.childCount; i++)
        {
            Transform child   = rightpathobj.Find("p" + i);
            PathNode  newnode = new PathNode(child.position.x, child.position.z, child.position.y);
            rightpath.AddNode(newnode);
        }
    }
Exemplo n.º 2
0
    override public void RemakePath()
    {
        path = new PathSpline();
        Transform pathobj = transform.Find("Path");

        for (int i = 0; i < pathobj.childCount; i++)
        {
            count = i;
            Transform child   = pathobj.Find("p" + i);
            PathNode  newnode = new PathNode(child.position.x, child.position.z, child.position.y);
            path.AddNode(newnode);
        }
    }
Exemplo n.º 3
0
    public void AddPath(AbstractTrack track)
    {
        //paused = true;
        //path_queue.Add(path);
        //pos_map.Add(totalLength,path);

        PathSpline path = track.GetPath();
        LinkedList <KeyValuePair <float, PathNode> > list = new LinkedList <KeyValuePair <float, PathNode> >();

        if (path == null)
        {
            return;
        }

        foreach (KeyValuePair <float, PathNode> temp in path.node_map)
        {
            list.AddLast(temp);
        }



        foreach (KeyValuePair <float, PathNode> temp in list)
        {
            if (traverser_path.back != null)
            {
                if (Mathf.Abs(temp.Value.x - traverser_path.back.x) < 0.05 && Mathf.Abs(temp.Value.y - traverser_path.back.y) < 0.05)
                {
                    continue;
                }
                if (Mathf.Abs(temp.Value.x - traverser_path.back.x) > 5 && Mathf.Abs(temp.Value.y - traverser_path.back.y) > 5)
                {
                    continue;
                }
            }
            //liner.positionCount = (liner.positionCount + 1);
            PathNode newnode = new PathNode(temp.Value.x, temp.Value.y, temp.Value.z);
            //vertices.Add(newnode.getVector() + new Vector3(0,5,0));
            //Point newpoint = Instantiate(linerendererobj, new Vector3(newnode.x, 2, newnode.y), Quaternion.identity).GetComponent<Point>();
            //newpoint.SetNum(count);
            //count++;
            //liner.SetPositions(vertices.ToArray());
            traverser_path.AddNode(newnode);
        }
        //paused = false;
        Global.Instance.last_inspected_track = track;
    }
Exemplo n.º 4
0
    override public void RemakePath()
    {
        leftpath = new PathSpline();
        Transform leftpathobj = transform.Find("LeftPath");

        for (int i = leftpathobj.childCount - 1; i > -1; i--)
        {
            Transform child   = leftpathobj.Find("p" + i);
            PathNode  newnode = new PathNode(child.position.x, child.position.z, child.position.y);
            leftpath.AddNode(newnode);
        }


        rightpath = new PathSpline();
        Transform rightpathobj = transform.Find("RightPath");

        for (int i = rightpathobj.childCount - 1; i > -1; i--)
        {
            Transform child   = rightpathobj.Find("p" + i);
            PathNode  newnode = new PathNode(child.position.x, child.position.z, child.position.y);
            rightpath.AddNode(newnode);
        }
    }