// Use this for initialization void Awake() { octile = new Octile(); waypoints = new List <xyLoc>(); astar = new GridAStar(Map.width, Map.height); useVelocity = true; transform.localScale = Vector3.one * Map.scale; }
private void Start() { target = FindObjectOfType <PlayerController>().transform; grid = FindObjectOfType <GridAStar>(); StartCoroutine(UpdatePath()); GetComponent <Animator>().Play("Scene"); pathUpdateMoveThreshold = grid.nodeRadius * 2; }
private void Start() { grid = FindObjectOfType <GridAStar>(); Crate.cratePickedUp += SpawnCrate; weaponIndex = Random.Range(0, weaponsPrefabs.Length); SpawnCrate(); }
// Use this for initialization void Start() { octile = new Octile(); waypoints = new List <xyLoc>(); // Sample set of waypoints. Movement is from last to first waypoints.Add(new xyLoc(0, 0)); waypoints.Add(new xyLoc(49, 0)); waypoints.Add(new xyLoc(49, 49)); waypoints.Add(new xyLoc(0, 49)); astar = new GridAStar(50, 50); useVelocity = true; }
static void Main() { int[,] mapInt = { { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, { 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 2, 1 }, { 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1 }, { 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1 }, { 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1 }, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, }; char[,] map = IntToCharArray(mapInt); char[] collisions = { '1' }; Vector2 start = new Vector2(1, 4); Vector2 end = FindEndPosition(map, '2'); GridAStar gridAStar = new GridAStar(false); List <Vector2> directions = gridAStar.FindPath(start, end, map, collisions); if (directions == null) { Console.WriteLine("No path"); } else { //Show all directions for (int i = 0; i < directions.Count; i++) { Console.WriteLine(directions[i].ToString()); } } Console.ReadLine(); }
private void Awake() { singleton = this; data = new AStarNode[gridXSideCount, gridYSideCount]; }
private void Awake() { grid = GetComponent <GridAStar>(); }