Author Topic: OnCountryClick method with WPM Globe Lite  (Read 404 times)

reddo

  • Newbie
  • *
  • Posts: 2
    • View Profile
OnCountryClick method with WPM Globe Lite
« on: February 10, 2019, 08:49:37 PM »
I'm wishing to use the OnCountryClick method from the script example on the forum for WPM Globe Lite but I can't access it as it doesn't contain the definition. Is Click events possible with Globe lite?
Thanks for any info
 
The code used is

Code
using UnityEngine;
using WPM;

public class CountryClick : MonoBehaviour
{

    WorldMapGlobe map;

    void Start()
    {
        map = WorldMapGlobe.instance;
        map.OnCountryEnter += Map_OnCountryEnter;
        map.OnCountryClick += Map_OnCountryClick;
        map.OnCountryExit += Map_OnCountryExit;
    }

    void Map_OnCountryEnter(int countryIndex, int regionIndex)
    {
        Debug.Log("Entered country: " + map.countries[countryIndex].name);
    }


    void Map_OnCountryClick(int countryIndex, int regionIndex)
    {
        Debug.Log("Click on country: " + map.countries[countryIndex].name);
    }

    void Map_OnCountryExit(int countryIndex, int regionIndex)
    {
        Debug.Log("Exited country: " + map.countries[countryIndex].name);

    }

}

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 4887
    • View Profile
Re: OnCountryClick method with WPM Globe Lite
« Reply #1 on: February 11, 2019, 12:12:22 AM »
Hi,

Events are not included in the Lite version of the asset.
You could use map.countryHighlightedIndex property and check if that property is >=0 along Input.GetMouseDown(0) to detect clicks on a country.

Regards



reddo

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: OnCountryClick method with WPM Globe Lite
« Reply #2 on: February 11, 2019, 12:53:28 AM »
Ok, thanks very much for the info.