0

我从 Unity 中的棋盘游戏开始,使用 C# 编程,我需要一个可选择的世界地图来将军队放置在每个区域并使其成为游戏板。我有一个 Raycasting 功能来选择每个国家,但我需要知道如何构建电路板并使国家/地区可选。

我有一个这样的板:http: //2.bp.blogspot.com/-vtEHvcmS-Ac/TtHk0IvsxoI/AAAAAAAAAnw/V6e_eGfmCac/s1600/Risk+II+Game+Board.jpg

我希望能够单独选择国家,就像它们本身就是对象一样。你知道有什么方法吗?

谢谢您的帮助!

4

1 回答 1

0

From the top of my head, I would take that image, and flood-fill every country with a different color.

Remember the color -> country mapping for later.

If your mouse cursor moves, check in the colored image for the color of the pixel under the mouse cursor, and you can look up the country your mouse hovers over.

To highlight the country graphically, you could also use the colored image to find out which pixels belong to a country, and give them a "selected" color on your screen.

于 2012-07-24T12:13:51.817 回答