示例#1
0
    public void BakeObjectRealTime(Pathfinding_Bakeable _bakeable)
    {
        BakeProcess bP = new BakeProcess(_bakeable);

        realtimeBake.Add(bP);
        StartCoroutine(_BakeObjectRealTime(bP));
    }
示例#2
0
    private IEnumerator WaitForPathfindable()
    {
        p    = PathFinding.self;
        bake = GetComponent <Pathfinding_Bakeable>();

        while (!PathFinding.pathfindable)
        {
            yield return(null);
        }

        //array information
        lengthX = p.grid.GetLength(0) - 1;
        lengthY = p.grid.GetLength(1) - 1;
        lengthZ = p.grid.GetLength(2) - 1;
    }
示例#3
0
    private IEnumerator _BakeObjectRealTime(Pathfinding_Bakeable bakeable)
    {
        GameObject g = bakeable.gameObject;

        bakeable.myNodes = BakeObject(g, bakeable.bakeType);

        while (true)
        {
            //reset old nodes
            bakeable.oldNodes = bakeable.myNodes;
            if (bakeable.oldNodes != null)
            {
                foreach (Node oldNode in bakeable.oldNodes)
                {
                    oldNode.filled = false;
                }
            }
            bakeable.myNodes = BakeObject(g, bakeable.bakeType);
            yield return(new WaitForSeconds(bakeable.refreshSpeed));
        }
    }
示例#4
0
 public void BakeObjectRealTime(Pathfinding_Bakeable bakeable)
 {
     realtimeBake.Add(StartCoroutine(_BakeObjectRealTime(bakeable)));
 }
示例#5
0
 public BakeProcess(Pathfinding_Bakeable bakeable)
 {
     this.bakeable = bakeable;
     obj           = bakeable.gameObject;
 }
示例#6
0
 private void Start()
 {
     p    = PathFinding.self;
     bake = GetComponent <Pathfinding_Bakeable>();
     MoveTowards(goal.position, null);
 }