void Start() { _tileMap = GetComponent <TGMap>(); _dispatcher = GetComponent <EGDispatcher>(); //The orthographic size if half the height of the camera float vertExtent = Camera.main.orthographicSize; //Calculate the half height of the screen float horizExtent = Camera.main.orthographicSize * Screen.width / Screen.height; float mapX = _tileMap.Map.Width * _tileMap.tileSize; float mapZ = _tileMap.Map.Height * _tileMap.tileSize; //Limit the camera to within half the width/height of the screen //of the bounds of the map minX = 0 + horizExtent; maxX = mapX - horizExtent; minZ = -(mapZ - vertExtent); maxZ = 0 - vertExtent; }
public void SetMap(TGMap map) { this._map = map; }