Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Vector2 MapToScreen(Vector2 source)
- {
- switch (CameraDirection)
- {
- case FaceDirection.NorthWest:
- return new Vector2(source.X * GameConstants.CellHalfWidth - source.Y * GameConstants.CellHalfWidth,
- source.X * GameConstants.CellHalfHeight + source.Y * GameConstants.CellHalfHeight);
- case FaceDirection.EastNorth:
- return new Vector2(source.Y * GameConstants.CellHalfWidth + source.X * GameConstants.CellHalfWidth,
- source.Y * GameConstants.CellHalfHeight - source.X * GameConstants.CellHalfHeight);
- case FaceDirection.SouthEast:
- return new Vector2(source.Y * GameConstants.CellHalfWidth - source.X * GameConstants.CellHalfWidth, -(source.X * GameConstants.CellHalfHeight + source.Y * GameConstants.CellHalfHeight));
- case FaceDirection.WestSouth:
- return new Vector2(-(source.X * GameConstants.CellHalfWidth + source.Y * GameConstants.CellHalfWidth), source.X * GameConstants.CellHalfHeight - source.Y * GameConstants.CellHalfHeight);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement