Author Topic: Three questions  (Read 234 times)

dude

  • Guest
Three questions
« on: June 12, 2019, 06:36:38 AM »
1)When will the package be upgraded to Unity 3.0a4?
2)How to get the province where the object is located?
3)How to assign a custom border for the province?

Thank. ;D

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 4843
    • View Profile
Re: Three questions
« Reply #1 on: June 12, 2019, 08:45:58 AM »
Hello,

1) Unity 3.0a4?
WMSK is compatible with all Unity versions starting 5.5.4 and later. We keep the compatibility version low to allow existing projects to upgrade to latest features. However the plan is migrate to 2017 LTS (2017.4) this summer (that's the minimum version - WMSK is compatible with 2018 and 2019 ofc).

2) GetProvinceIndex can accept a Vector2 and will return the province under that map position.
You can use the WorldToMap2DPosition method to convert between world space to local map position:

Code
Vector2 pos = map.WorldToMap2DPosition (worldPosition);
int provinceIndex = GetProvinceIndex (pos);

3) Only country can have an animated/custom border at this moment. You can get the points of the border for any province using:

Code
Province prov;
...
List<Vector2> points = prov.mainRegion.points;

Each point is in local space (-0.5 left to 0.5 right, same for bottom/top). Use map.transform.TransformPoint(point) to get the vertex in world space.

With this info you can construct the shape or custom line for any province and parent it to the map.