Skip to content

Fix Unity city coordinate conversion#60

Merged
blouns merged 1 commit into
mainfrom
codex/city-entry-coordinate-fix
Jun 19, 2026
Merged

Fix Unity city coordinate conversion#60
blouns merged 1 commit into
mainfrom
codex/city-entry-coordinate-fix

Conversation

@blouns

@blouns blouns commented Jun 19, 2026

Copy link
Copy Markdown
Owner

Summary

  • Fix WismUnity city marker to game-coordinate conversion for centered 2x2 city markers.
  • Preserve runtime hiding of editor marker sprites.
  • Add a focused PlayMode regression for city marker top-left coordinates.

Validation

  • Unity isolated PlayMode: CityEntryCoordinateTests.CityEntry_ReturnsTopLeftCoordinateForCenteredCityMarker passed.
  • Unity isolated PlayMode: BugFixRegressionTests passed 5/5.
  • WISM boundary checks passed.

Copilot AI review requested due to automatic review settings June 19, 2026 00:38

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates WismUnity’s Unity↔game coordinate conversion so 2x2 city markers map back to the correct WismClient top-left tile, and adds a targeted PlayMode regression test to prevent the city-marker offset bug from returning.

Changes:

  • Adjust WorldTilemap to use a tilemap-aware ConvertUnityToGameVector implementation and refactor click picking to accept an injected screen position.
  • Update CityEntry coordinate offset logic for centered 2x2 city markers and preserve runtime hiding of editor marker sprites.
  • Add a focused PlayMode test validating city marker top-left coordinate conversion.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
WismUnity/Assets/Scripts/UnityGame/Mapping/WorldTilemap.cs Routes Unity→game conversion through tilemap-aware utilities; adds GetTileAtScreenPosition.
WismUnity/Assets/Scripts/UnityGame/Editors/CityEntry.cs Updates city marker coordinate offset logic; hides marker sprite at runtime on enable/awake.
WismUnity/Assets/Scripts/UnityGame/Common/MapUtilities.cs Makes Unity→game conversion tilemap-aware using bounds/anchor and WorldToCell.
WismUnity/Assets/Scripts/Tests/PlayMode/CityEntryCoordinateTests.cs Adds a PlayMode regression test for centered 2x2 city marker → top-left game coordinate.
WismUnity/Assets/Scripts/Tests/PlayMode/CityEntryCoordinateTests.cs.meta Adds Unity meta for the new test script.
Files not reviewed (1)
  • WismUnity/Assets/Scripts/Tests/PlayMode/CityEntryCoordinateTests.cs.meta: Generated file

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +11 to +15
private void Awake()
{
HideRuntimeMarkerSprite();
}

Comment on lines +1 to +2
fileFormatVersion: 2
guid: 97044d356fa34e6a8d698b17b32b2172
@blouns blouns merged commit 96e072d into main Jun 19, 2026
3 checks passed
@blouns blouns deleted the codex/city-entry-coordinate-fix branch June 19, 2026 00:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants