public void Init(int floor, Vector2Int playerPosition, Vector2Int startPosition, Vector2Int goalPosition, BoundsInt mapBound, List <Vector2Int> mapList) { FloorLabel.text = "F" + floor.ToString(); _mapBound = mapBound; _mapList = mapList; _playerPosition = playerPosition; _goalPosition = goalPosition; Sprite sprite; _texture2d = new Texture2D(mapBound.size.x + 3, mapBound.size.y + 3, TextureFormat.ARGB32, false); _texture2d.filterMode = FilterMode.Point; sprite = Sprite.Create(_texture2d, new Rect(0, 0, _texture2d.width, _texture2d.height), Vector2.zero); //LittleMap.sprite = sprite; //BigMap.sprite = sprite; //LittleMap.rectTransform.sizeDelta = new Vector2(_texture2d.width * Scale, _texture2d.height * Scale); //BigMap.rectTransform.sizeDelta = new Vector2(_texture2d.width * Scale, _texture2d.height * Scale); for (int i = 0; i < _texture2d.width; i++) { for (int j = 0; j < _texture2d.height; j++) { _texture2d.SetPixel(i, j, Color.clear); } } _texture2d.Apply(); //Start.transform.localPosition = new Vector2((startPosition.x - _mapBound.center.x) * Scale, (startPosition.y - _mapBound.center.y) * Scale); //Goal.transform.localPosition = new Vector2((goalPosition.x - _mapBound.center.x) * Scale, (goalPosition.y - _mapBound.center.y) * Scale); //if (playerPosition == goalPosition) //{ // Goal.SetActive(true); //} //else //{ // Goal.SetActive(false); //} Vector2 mapStartPosition = new Vector2((startPosition.x - _mapBound.center.x) * Scale, (startPosition.y - _mapBound.center.y) * Scale); Vector2 mapGoalPosition = new Vector2((goalPosition.x - _mapBound.center.x) * Scale, (goalPosition.y - _mapBound.center.y) * Scale); LittleMap.Init(mapStartPosition, mapGoalPosition, sprite, _texture2d); BigMap.Init(mapStartPosition, mapGoalPosition, sprite, _texture2d); if (playerPosition == goalPosition) { LittleMap.SetStartVisible(false); LittleMap.SetGoalVisible(true); BigMap.SetStartVisible(false); BigMap.SetGoalVisible(true); } else { LittleMap.SetStartVisible(true); LittleMap.SetGoalVisible(false); BigMap.SetStartVisible(true); BigMap.SetGoalVisible(false); } }