コード例 #1
0
    private void Start()
    {
        startingGenerator = FindObjectOfType <TraversalGenerator>();
        navMesh           = new TraversalAStarNavigation(traversalHolder);

        selectedLine = traversalHolder.GetRandomLine();
    }
コード例 #2
0
    private void Update()
    {
        if (startingGenerator == null)
        {
            startingGenerator = FindObjectOfType <TraversalGenerator>();
        }
        if (getRandomPoint)
        {
            selectedLine = traversalHolder.GetRandomLine();
        }

        gen = traversalHolder.GetClosestGenerator(end.position);
        if (gen)
        {
            Vertex vert = traversalHolder.GetMiddleLineForCurrentGenerator(gen).vertex;
            path = navMesh.GetPathFromTo(traversalHolder.GetMiddleLineForCurrentGenerator(startingGenerator).vertex, vert);
        }
    }