Ejemplo n.º 1
0
        void Update()
        {
            //Reset Pathfinding Class - Shouldn't Need To Do More Than Once This. For Debug Purposes
            if (Input.GetKeyDown(KeyCode.C))
            {
                Debug.Log("Generating PathFinding");
                pathFinding = new PathFinding.PathFinding();
            }

            //Click!
            if (Input.GetMouseButtonDown(1))
            {
                if (!Input.GetKey(KeyCode.LeftShift))
                {
                    pos1 = GetMousePosition();
                }
                else
                {
                    pos2 = GetMousePosition();
                }
            }

            //Path Find!
            if (Input.GetKeyDown(KeyCode.Space))
            {
                path = pathFinding.FindPath(pos1, pos2);
                //Set Up Line To Be Rendered
                if (path != null)
                {
                    line.positionCount = path.Count;
                    line.SetPositions(ConvertPathToLine(path));
                }
            }
        }
Ejemplo n.º 2
0
 private void Start()
 {
     pathFinding = new PathFinding.PathFinding();
 }