Nez.Portable/ECS/Components/FollowCamera.cs
/// <summary>
/// Clamps the camera so it never leaves the visible area of the map.
/// </summary>
/// <returns>The to map size.</returns>
/// <param name="position">Position.</param>
Clamps the camera so it never leaves the visible area of the map.
Clamps the camera so it never leaves the visible area of the map .
Vector2 clampToMapSize(Vector2 position)
        {
            var halfScreen = new Vector2(camera.bounds.width, camera.bounds.height) * 0.5f;
            var cameraMax = new Vector2(mapSize.X - halfScreen.X, mapSize.Y - halfScreen.Y);
            return Vector2.Clamp(position, halfScreen, cameraMax);
        }
Vector2 clampToMapSize ( Vector2 position ) { var halfScreen = new Vector2 ( camera . bounds . width , camera . bounds . height ) * 0.5f ; var cameraMax = new Vector2 ( mapSize . X - halfScreen . X , mapSize . Y - halfScreen . Y ) ; return Vector2 . Clamp ( position , halfScreen , cameraMax ) ; }
Clamps the camera so it never leaves the visible area of the map.
Clamps the camera so it never leaves the visible area of the map .
The to map size.
The to map size .
position
Vector2
None