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