lab6 dop
This commit is contained in:
1 parent
bca661e132
commit
ed0437638b
9 files changed
+3442
-17
No files matched your search
@@ -10,6 +10,7 @@ namespace Code.UI
|
||||
{
|
||||
public class Lab6Controller : MonoBehaviour
|
||||
{
|
||||
public bool isDop;
|
||||
public Graph graph;
|
||||
public Agent agent;
|
||||
public Transform targetMarker;
|
||||
@@ -171,8 +172,15 @@ namespace Code.UI
|
||||
targetPos.y = 0.5f;
|
||||
targetMarker.position = targetPos;
|
||||
|
||||
var path = _useBfs ? graph.GetPathBfs(agent.gameObject, targetMarker.gameObject) : graph.GetPathDfs(agent.gameObject, targetMarker.gameObject);
|
||||
|
||||
List<Vertex> path;
|
||||
|
||||
if (!isDop)
|
||||
path = _useBfs
|
||||
? graph.GetPathBfs(agent.gameObject, targetMarker.gameObject)
|
||||
: graph.GetPathDfs(agent.gameObject, targetMarker.gameObject);
|
||||
else
|
||||
path = graph.GetPathWeights(agent.gameObject, targetMarker.gameObject);
|
||||
|
||||
if (path is { Count: > 0 })
|
||||
{
|
||||
_currentPath = path;
|
||||
|
||||
Reference in new issue
Block a user