private static List <AbWorldTile> FindPathData(Vector3 startWorldPosition, Vector2Int endWorldPosition) { AbWorldTile startNode = AbGridTileStorage.GetTileData(startWorldPosition);//GetGridObject(startX, startY); AbWorldTile endNode = AbGridTileStorage.GetTileData(endWorldPosition.x, endWorldPosition.y); return(FindPathData(startNode, endNode)); }
private void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } GetWorldTiles(); }
private static List <Vector3> FindPath(List <AbWorldTile> path) { if (path != null) { List <Vector3> vectorPath = new List <Vector3>(); foreach (AbWorldTile pathNode in path) { //vectorPath.Add( //new Vector3(pathNode.x, pathNode.y) * grid.GetCellSize() + Vector3.one * grid.GetCellSize() * .5f); //new Vector3(pathNode.x, pathNode.y) + Vector3.one * .5f); vectorPath.Add(AbGridTileStorage.WorldPosition(pathNode)); } return(vectorPath); } return(null); }
// Update is called once per frame private void Update() { if (Input.GetMouseButtonDown(0)) { Vector3 point = Camera.main.ScreenToWorldPoint(Input.mousePosition); var _tile = AbGridTileStorage.GetTileData(point); if (_tile != null) { string w = " -walkable"; if (!_tile.isWalkable) { w = " -not walkable"; } print($"Tile x{_tile.x}:y{_tile.y}, costs: {_tile.Cost}{w}"); //if (_tile.TileBase != null) //{ // _tile.TilemapMember.SetTileFlags(_tile.LocalPlace, TileFlags.None); // _tile.TilemapMember.SetColor(_tile.LocalPlace, Color.green); // _tile.isWalkable = false; //} } } }
public static AbWorldTile GetNode(int x, int y) { return(AbGridTileStorage.GetTileData(x, y)); }