Exemple #1
0
    //生成整个轨道模型
    public void CreateTrailer(GlobalVaribles.Trailer_Para trailer_Para)
    {
        GameObject trailer     = CreateEmpty(trailer_Para.trailerName);
        GameObject in_trailer  = new GameObject("in_trailer");
        GameObject out_trailer = new GameObject("out_trailer");

        in_trailer.transform.parent  = trailer.transform;
        out_trailer.transform.parent = trailer.transform;
        //创建内轨道
        //曲线
        GameObject CurveGroup_in = new GameObject("CurveGroup_in");

        CurveGroup_in.transform.parent = in_trailer.transform;
        for (int i = 0; i < GlobalVaribles.in_curve_Para_list.Count; i++)
        {
            GameObject curve = CreateModel.CreateCurve(GlobalVaribles.in_curve_Para_list[i]);
            curve.transform.parent = CurveGroup_in.transform;
        }
        //直线组
        GameObject LineGroup_in = new GameObject("LineGroup_in");

        LineGroup_in.transform.parent = in_trailer.transform;
        for (int i = 0; i < GlobalVaribles.in_line_Para_list.Count; i++)
        {
            GameObject cube = CreateModel.CreateLine(GlobalVaribles.in_line_Para_list[i]);
            cube.transform.parent = LineGroup_in.transform;
        }
        //创建外轨道
        //曲线组
        GameObject CurveGroup_out = new GameObject("CurveGroup_out");

        CurveGroup_out.transform.parent = out_trailer.transform;
        for (int i = 0; i < GlobalVaribles.out_curve_Para_list.Count; i++)
        {
            GameObject curve = CreateModel.CreateCurve(GlobalVaribles.out_curve_Para_list[i]);
            curve.transform.parent = CurveGroup_out.transform;
        }
        //直线
        GameObject LineGroup_out = new GameObject("LineGroup_out");

        LineGroup_out.transform.parent = out_trailer.transform;
        for (int i = 0; i < GlobalVaribles.out_line_Para_list.Count; i++)
        {
            GameObject cube = CreateModel.CreateLine(GlobalVaribles.out_line_Para_list[i]);
            cube.transform.parent = LineGroup_out.transform;
        }

        //ModelTool.CreatePrefabObj(trailer, "Trailer");
    }