public void GeneratePath()
    {
        path = new NavMeshPath();
        NavMesh.CalculatePath(start.position, rabbit.position, 1 << 4, path);
        pathCorners = new Vector3[path.corners.Length];
        pathCorners = path.corners;

        place        = ScriptableObject.CreateInstance <PlaceObjsByCurve>();
        place.rad    = rad;
        place.dim    = dim;
        place.rar    = 8;
        place.offset = 10.0f;

        float uplift = 5.0f;

        for (int i = 0; i < pathCorners.Length - 1; i++)
        {
            Vector3 nullY1 = new Vector3(pathCorners[i].x, 0.0f + uplift, pathCorners[i].z);
            Vector3 nullY2 = new Vector3(pathCorners[i + 1].x, 0.0f + uplift, pathCorners[i + 1].z);
            place.Run(
                nullY1,
                nullY2);
            place.objsParent = smellsParent;
            place.corr       = corr;
            //Debug.Log(pref.name);
            place.PlaceObjByGraph(pref);
        }
    }
Beispiel #2
0
    private void Init()
    {
        float uplift = 15.0f;

        placeByCurve     = ScriptableObject.CreateInstance <PlaceObjsByCurve>();
        placeByCurve.rad = rad;
        placeByCurve.dim = dim;

        for (int i = 0; i < path.corners.Length - 1; i++)
        {
            //Debug.Log(i);
            //Debug.Log(pathCorners[i].y + " | " + pathCorners[i+1].y);
            Vector3 nullY1 = new Vector3(pathCorners[i].x, 0.0f + uplift, pathCorners[i].z);
            Vector3 nullY2 = new Vector3(pathCorners[i + 1].x, 0.0f + uplift, pathCorners[i + 1].z);
            placeByCurve.rar  = rar;
            placeByCurve.corr = corr;
            placeByCurve.Run(
                nullY1,
                nullY2);
            placeByCurve.objsParent = transform;
            placeByCurve.PlaceObjByGraph(trail);
            //StartCoroutine(placeByCurve.DebugLines());
        }
    }