Exemplo n.º 1
0
    //Main Pathfinding function, will be called to generate the path and will return the final path
    public List <SCR_NodeClass> FindingPath(SCR_NodeClass startPoint, SCR_NodeClass endPoint, List <SCR_NodeClass> nodeSelection)
    {
        listOfNodes     = new List <SCR_NodeClass>();
        listOfNodes     = nodeSelection;
        pathfound       = false;
        finalMapPathway = new List <SCR_NodeClass>();
        open            = new List <CalculatePath>();
        closed          = new List <CalculatePath>();
        nodeManager     = GetComponent <SCR_NodeManager>();
        start           = startPoint;
        goal            = endPoint;
        open.Add(new CalculatePath(startPoint, null));
        GeneratePath();
        FindPath();

        open.Clear();
        closed.Clear();
        return(finalMapPathway);
    }
 private void OnEnable()
 {
     nodes = GameObject.FindGameObjectWithTag("PathFinderManager").GetComponent <SCR_NodeManager>();
 }
 //retreives necessary values when clicked on
 private void OnEnable()
 {
     nodeManager = (SCR_NodeManager)target;
 }
Exemplo n.º 4
0
 private void Start()
 {
     nodeManager = GameObject.FindGameObjectWithTag("PathFinderManager").GetComponent <SCR_NodeManager>();
     offset      = Map.transform.position.y + (transform.position.y - Map.transform.position.y);
 }