private void OnMapChangeListener() { var agentGridPos = GridHelper.GetGridPosFromWorldPoint(transform.position); if (!_terrainInfo.IsValidGrisPosition(agentGridPos)) { transform.position = Vector3.zero; } }
void Update() { if (Input.GetMouseButtonDown(0)) { var gridPos = GridHelper.GetGridPosFromScreenPoint(Input.mousePosition); if (_terrainInfo.IsValidGrisPosition(gridPos)) { if (_terrainInfo.IsWall(gridPos)) { _terrainInfo.RemoveWall(gridPos); } else { _terrainInfo.SetWall(gridPos); } } } }
//public TileBehavior GetTileAt(int col, int row) //{ // Debug.Assert(_terrainInfo.IsValidGrisPosition(col, row), "Out of bounds", this); // return _tiles[col, row]; //} public void SetTileColor(Vector2Int pos, Color color) { Debug.Assert(_terrainInfo.IsValidGrisPosition(pos), "Out of bounds", this); _tiles[pos.x, pos.y].SetColor(color); }