public void StartFindRoomPath(HashSet <RoomNode> path) { int potentailDoors = _roomConstructor.potentailDoors; var target = new Vector3[potentailDoors]; var origin = new Vector3(); var doors = 0; foreach (var node in path) { if (node.roomType == RoomType.end) { if (doors < potentailDoors) { target[doors] = new Vector3(node.gridX, node.gridY, 0); doors++; } } if (node.roomType == RoomType.origin) { origin = new Vector3(node.gridX, node.gridY, 0); } } foreach (var targetPos in target) { PathRequestManager.RequestPath(origin, targetPos, _roomGrid, _pathFinding, PathFind); } StartCoroutine(ProcCreateNewRoom()); }
public void StartFindPath() { PathRequestManager.RequestPath(transform.position, target.position, grid, pathFinding, PathFind); }