DCDC24-EmissionVision/Assets/WorldPoliticalMapGlobeEdition/Demos/02 SpriteMarkers/SpriteClickHandler.cs
Negin Soltani 37239732ac Initial Push
- Globe Asset
- Spatial Anchors
- Photon Implementation
- Scripts for Globe Control and Initial Country Colorizing
- Script for Reading csv file
2024-05-16 14:41:23 +02:00

39 lines
718 B
C#

using UnityEngine;
namespace WPM {
public class SpriteClickHandler : MonoBehaviour {
public WorldMapGlobe map;
void Start () {
if (GetComponent<Collider2D> () == null)
gameObject.AddComponent<BoxCollider2D> ();
if (map == null)
map = WorldMapGlobe.instance;
}
void OnMouseDown () {
Debug.Log ("Mouse down on sprite!");
}
void OnMouseUp () {
Debug.Log ("Mouse up on sprite!");
int countryIndex = map.countryLastClicked;
if (countryIndex >= 0) {
Debug.Log ("Clicked on " + map.countries [countryIndex].name);
}
}
void OnMouseEnter () {
Debug.Log ("Mouse over the sprite!");
}
void OnMouseExit () {
Debug.Log ("Mouse exited the sprite!");
}
}
}