예제 #1
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        CurveImplementation curve = (CurveImplementation)target;

        if (GUILayout.Button("Instantiate"))
        {
            var points = curve.MakeSpline(curve.trackMaker.points, curve.closedLoop);
            curve.GenerateRoadMesh(points, "test", curve.closedLoop);
            //curve.GenerateMesh(points);
        }

        if (GUILayout.Button("Make highway"))
        {
            var points = curve.MakeSpline(curve.trackMaker.points, false);
            curve.GenerateRoadMesh(points, "highway", false);
            //curve.GenerateMesh(points);
        }

        if (GUILayout.Button("Make road"))
        {
            var points = curve.MakeSpline(curve.trackMaker.points, curve.closedLoop);
            curve.GenerateRoadMesh(points, "road", curve.closedLoop);
            //curve.GenerateMesh(points);
        }

        if (GUILayout.Button("Make akima road"))
        {
            curve.GenerateRoadMesh(curve.trackMaker.curve, "akima road", curve.closedLoop);
            //curve.GenerateMesh(points);
        }

        if (GUILayout.Button("Make road sections"))
        {
            curve.GenerateRoadMesh(curve.MakeSpline(curve.trackMaker.bottom, false), "bottom", false);
            curve.GenerateRoadMesh(curve.MakeSpline(curve.trackMaker.right, false), "right", false);
            curve.GenerateRoadMesh(curve.MakeSpline(curve.trackMaker.top, false), "top", false);
            curve.GenerateRoadMesh(curve.MakeSpline(curve.trackMaker.left, false), "left", false);
            //curve.GenerateMesh(points);
        }

        if (GUILayout.Button("Highlight closest points"))
        {
            curve.DetectClosedPoints();
        }

        if (GUILayout.Button("Find closest points"))
        {
            curve.CreateIntersection(curve.firstRoad, curve.secondRoad, curve.extrude, 8);
            var i = 0;
            foreach (var c in curve.connections)
            {
                curve.GenerateRoadMesh(c, $"connection {i}", false);
                i++;
            }
        }
    }
예제 #2
0
    public static void SpawnTokens()
    {
        Instance.Tokens = new List <Token>(Instance.NumberTokensToSpawn);

        Instance._numTokensSpawned = 0;

        //TODO:: hardcoded for now. Fix script execution order to allow the read of spawnRadius on TokenSpawner.
        CurveImplementation.SetTokenPositions(Instance.NumberTokensToSpawn);
    }
예제 #3
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        CurveImplementation curve = (CurveImplementation)target;

        if (GUILayout.Button("Instantiate"))
        {
            curve.DrawSpline(true);
            curve.GenerateMesh();
        }
    }
예제 #4
0
    void Awake()
    {
        CurveImplementation script = GetComponent <CurveImplementation>();

        script.enabled = false;
        points.Clear();
        float zPos = 0;

        for (int i = 0; i < 512; i++)
        {
            Vector3    pos      = new Vector3(Random.Range(-100, 100), 0, zPos);
            GameObject newPoint = (GameObject)Instantiate(pointPrefab, pos, Quaternion.identity);
            newPoint.GetComponent <PointControl>().width = Random.Range(20, 200);
            points.Add(newPoint);
            zPos += Random.Range(150, 200);
        }
        script.enabled = true;
    }
예제 #5
0
 public void getSpawnPoint(Transform carBody)
 {
     //TODO:: work out why the respawn doesn't work when it is so high, changing the value to 50, is too high...
     CurveImplementation.SetSpawnTransform(carBody, _progressDistance, 20);
 }