// protected override void OnMarkerRemove(MapMarker marker) { // } // protected override void OnMarkerAdd(MapMarker marker) { marker.ShowMessage(false); marker.ShowDistance(false); marker.ShowDirectionals(!UIMaps.RegisteredObjectIsPlayer(marker.uIRegisteredObject)); marker.showRotation = false; }
void AddWaypoint(float zOffset) { if (defaultWaypointRegisteredObj == null && currentWaypointRegisterObj == null) { // if (currentWaypointMarker != null) { // TODO: Get ground Y if (selectedMarker == null || UIMaps.RegisteredObjectIsPlayer(selectedMarker.uIRegisteredObject)) { Vector3 worldPos = Vector3.zero; Vector2 wPos = (move);// + Vector2.one * zOffset);// * mapSize; Debug.LogError(wPos); worldPos.x = mapCenter.x + wPos.x * mapRadius * 2; worldPos.z = mapCenter.y + wPos.y * mapRadius * 2; Debug.LogError(worldPos); // register the default empty icon defaultWaypointRegisteredObj = UIMaps.RegisterDynamicObjectWithUI( "MapWaypoint", GetInstanceID(), worldPos, Vector3.forward, "Waypoint", null, null, null, null ); defaultWaypointRegisteredObj.SetAsWaypoint(true); defaultWaypointRegisteredObj.ShowMapType(UIMapsObject.ShowType.MainMap, true); defaultWaypointRegisteredObj.ShowMapType(UIMapsObject.ShowType.MiniMap, true); defaultWaypointRegisteredObj.ShowMapType(UIMapsObject.ShowType.Compass, true); defaultWaypointRegisteredObj.ShowMapType(UIMapsObject.ShowType.ScreenMap, true); } else { // Debug.Log("making waypoing already thtere"); currentWaypointRegisterObj = selectedMarker.uIRegisteredObject; // worldPos = selectedMarker.GetMarkerPosition(); currentWaypointRegisterObj.SetAsWaypoint(true); // alraedy showing map... // currentWaypointMarker.uIRegisteredObject.ShowMainMap(true); currentWaypointRegisterObj.ShowMapType(UIMapsObject.ShowType.MiniMap, true); currentWaypointRegisterObj.ShowMapType(UIMapsObject.ShowType.Compass, true); currentWaypointRegisterObj.ShowMapType(UIMapsObject.ShowType.ScreenMap, true); // currentWaypointMarker = AddMapMarker ("MapWaypoint", GetInstanceID(), waypointIcon, () => worldPos, "Waypoint"); } } else { if (currentWaypointRegisterObj != null) { currentWaypointRegisterObj.SetAsWaypoint(false); currentWaypointRegisterObj.ShowMapType(UIMapsObject.ShowType.ScreenMap, false); if (!currentWaypointRegisterObj.loadedLocally) { currentWaypointRegisterObj.ShowMapType(UIMapsObject.ShowType.MiniMap, false); currentWaypointRegisterObj.ShowMapType(UIMapsObject.ShowType.Compass, false); } currentWaypointRegisterObj = null; } // else { // } if (defaultWaypointRegisteredObj != null) { defaultWaypointRegisteredObj = UIMaps.DeregisterDynamicObjectWithUI(GetInstanceID()); } // currentWaypointMarker = null; // defaultWaypointRegisteredObj = null; // RemoveMapMarker(GetInstanceID()); // currentWaypointMarker = null; } }