private void Start() { globeManager = interfaceFactory.GlobeManager; errorHandler = interfaceFactory.ErrorHandler; if (globeManager == null || errorHandler == null) { gameObject.SetActive(false); } else { worldMapGlobe = globeManager.WorldMapGlobe; if (worldMapGlobe == null) { errorHandler.ReportError("World Map Globe missing", ErrorState.restart_scene); } globeParser = globeManager.GlobeParser; if (globeParser == null) { errorHandler.ReportError("Globe Parser missing", ErrorState.restart_scene); } else { provinceParser = globeParser.ProvinceParser; if (provinceParser == null) { errorHandler.ReportError("Province Parser missing", ErrorState.restart_scene); } } } }
// Use this for initialization void Start() { float selected_latitude = 40.71f; float selected_longitude = -74f; Sprite selected_sprite = Resources.Load <Sprite>("NewYork"); WorldMapGlobe map = WorldMapGlobe.instance; map.calc.fromLatDec = selected_latitude; map.calc.fromLonDec = selected_longitude; map.calc.fromUnit = UNIT_TYPE.DecimalDegrees; map.calc.Convert(); Vector3 sphereLocation = map.calc.toSphereLocation; // Create sprite GameObject destinationSprite = new GameObject(); SpriteRenderer dest_sprite = destinationSprite.AddComponent <SpriteRenderer>(); dest_sprite.sprite = selected_sprite; // Add sprite billboard to the map with custom scale, billboard mode and little bit elevated from surface (to prevent clipping with city spots) map.AddMarker(destinationSprite, sphereLocation, 0.02f, true, 0.1f); // Add click handlers destinationSprite.AddComponent <SpriteClickHandler>(); // Locate it on the map map.FlyToLocation(sphereLocation); map.autoRotationSpeed = 0f; }
void Start() { buttonStyle = new GUIStyle(); buttonStyle.alignment = TextAnchor.MiddleLeft; buttonStyle.normal.background = Texture2D.whiteTexture; buttonStyle.normal.textColor = Color.white; // setup GUI resizer - only for the demo GUIResizer.Init(800, 500); // Get map instance to Globe API methods map = WorldMapGlobe.instance; earthMat = map.earthMaterial; // Gets a copy of current Earth texture and make it available as render texture for faster blending rtEarth = new RenderTexture(2048, 1024, 0); Graphics.Blit(map.earthTexture, rtEarth); rtVirusMap = new RenderTexture(2048, 1024, 0); rtCombined = new RenderTexture(2048, 1024, 0); circleMat.SetTexture("_MaskTex", earthMask); // to avoid painting over Sea StartPlague(); }
// the cell index of the first selected cell when setting edge cost between two neighbour cells void Start() { // UI Setup - non-important, only for this demo labelStyle = new GUIStyle(); labelStyle.alignment = TextAnchor.MiddleLeft; labelStyle.normal.textColor = Color.white; labelStyleShadow = new GUIStyle(labelStyle); labelStyleShadow.normal.textColor = Color.black; buttonStyle = new GUIStyle(labelStyle); buttonStyle.alignment = TextAnchor.MiddleLeft; buttonStyle.normal.background = Texture2D.whiteTexture; buttonStyle.normal.textColor = Color.white; sliderStyle = new GUIStyle(); sliderStyle.normal.background = Texture2D.whiteTexture; sliderStyle.fixedHeight = 4.0f; sliderThumbStyle = new GUIStyle(); sliderThumbStyle.normal.background = Resources.Load <Texture2D> ("thumb"); sliderThumbStyle.overflow = new RectOffset(0, 0, 8, 0); sliderThumbStyle.fixedWidth = 20.0f; sliderThumbStyle.fixedHeight = 12.0f; // setup GUI resizer - only for the demo GUIResizer.Init(800, 500); // Get map instance to Globe API methods map = WorldMapGlobe.instance; // Setup grid events map.OnCellEnter += (int cellIndex) => Debug.Log("Entered cell: " + cellIndex); map.OnCellExit += (int cellIndex) => Debug.Log("Exited cell: " + cellIndex); map.OnCellClick += HandleOnCellClick; }
void Start() { labelStyle = new GUIStyle(); labelStyle.normal.textColor = Color.white; buttonStyle = new GUIStyle(labelStyle); buttonStyle.alignment = TextAnchor.MiddleLeft; buttonStyle.normal.background = Texture2D.whiteTexture; buttonStyle.normal.textColor = Color.white; sliderStyle = new GUIStyle(); sliderStyle.normal.background = Texture2D.whiteTexture; sliderStyle.fixedHeight = 4.0f; sliderThumbStyle = new GUIStyle(); sliderThumbStyle.normal.background = Resources.Load <Texture2D> ("thumb"); sliderThumbStyle.overflow = new RectOffset(0, 0, 8, 0); sliderThumbStyle.fixedWidth = 20.0f; sliderThumbStyle.fixedHeight = 12.0f; colorPicker = gameObject.GetComponent <ColorPicker> (); // setup GUI resizer - only for the demo GUIResizer.Init(800, 500); // Get map instance to Globe API methods map = WorldMapGlobe.instance; map.OnDrag += PaintEarth; ResetTexture(); }
void Start() { gameManager = interfaceFactory.GameManager; globeManager = interfaceFactory.GlobeManager; uiManager = interfaceFactory.UIManager; errorHandler = interfaceFactory.ErrorHandler; if (gameManager == null || globeManager == null || uiManager == null || errorHandler == null) { gameObject.SetActive(false); } else { if (componentMissing) { errorHandler.ReportError("Mouse Cell Enterer missing component", ErrorState.restart_scene); } worldMapGlobe = globeManager.WorldMapGlobe; if (worldMapGlobe == null) { errorHandler.ReportError("World Map Globe missing", ErrorState.restart_scene); } try { globeManager.WorldMapGlobe.OnCellEnter += HandleOnCellEnter; } catch (System.Exception ex) { errorHandler.CatchException(ex, ErrorState.restart_scene); } } }
void Start() { // UI Setup - non-important, only for this demo labelStyle = new GUIStyle(); labelStyle.alignment = TextAnchor.MiddleCenter; labelStyle.normal.textColor = Color.white; labelStyleShadow = new GUIStyle(labelStyle); labelStyleShadow.normal.textColor = Color.black; buttonStyle = new GUIStyle(labelStyle); buttonStyle.alignment = TextAnchor.MiddleLeft; buttonStyle.normal.background = Texture2D.whiteTexture; buttonStyle.normal.textColor = Color.white; sliderStyle = new GUIStyle(); sliderStyle.normal.background = Texture2D.whiteTexture; sliderStyle.fixedHeight = 4.0f; sliderThumbStyle = new GUIStyle(); sliderThumbStyle.normal.background = Resources.Load <Texture2D> ("thumb"); sliderThumbStyle.overflow = new RectOffset(0, 0, 8, 0); sliderThumbStyle.fixedWidth = 20.0f; sliderThumbStyle.fixedHeight = 12.0f; // setup GUI resizer - only for the demo GUIResizer.Init(800, 500); // Get map instance to Globe API methods map = WorldMapGlobe.instance; NewPath(); }
void Start() { errorHandler = interfaceFactory.ErrorHandler; gameManager = interfaceFactory.GameManager; globeManager = interfaceFactory.GlobeManager; uiManager = interfaceFactory.UIManager; if (errorHandler == null || gameManager == null || globeManager == null || uiManager == null) { gameObject.SetActive(false); } else { if (componentMissing == true) { errorHandler.ReportError("Pathfinder missing component", ErrorState.restart_scene); } globeParser = globeManager.GlobeParser; if (globeParser == null) { errorHandler.ReportError("Globe Parser missing", ErrorState.restart_scene); } worldMapGlobe = globeManager.WorldMapGlobe; if (worldMapGlobe == null) { errorHandler.ReportError("World Map Globe missing", ErrorState.restart_scene); } playerManager = gameManager.PlayerManager; if (playerManager == null) { errorHandler.ReportError("Player Manager missing", ErrorState.restart_scene); } CellsInRange = globeParser.GetCellsInRange(playerCharacter.CellLocation, TravelRange + 1); } }
public static float GetScale(WorldMapGlobe map) { Camera cam = map.mainCamera; if (cam == null || cam.pixelWidth == 0) { return(0); } float oldFV = cam.fieldOfView; if (!UnityEngine.XR.XRSettings.enabled) { cam.fieldOfView = 60.0f; } Vector3 refPos = map.transform.position; if (map.earthInvertedMode) { refPos += Vector3.forward; // otherwise, transform.position = 0 in inverted mode } Vector3 a = cam.WorldToScreenPoint(refPos); Vector3 b = new Vector3(a.x, a.y + CITY_SIZE_ON_SCREEN * map.cityIconSize, a.z); Vector3 aa = cam.ScreenToWorldPoint(a); Vector3 bb = cam.ScreenToWorldPoint(b); if (!UnityEngine.XR.XRSettings.enabled) { cam.fieldOfView = oldFV; } float scale = (aa - bb).magnitude / map.transform.localScale.x; // * map.cityIconSize; return(Mathf.Clamp(scale, 0.00001f, 0.005f)); }
void Start() { // Listen to map clicks map = WorldMapGlobe.instance; map.OnClick += (Vector3 sphereLocation, int mouseButtonIndex) => map.AddMarker(MARKER_TYPE.CIRCLE_PROJECTED, sphereLocation, kmRadius, ringWidthStart, ringWidthEnd, Color.green); // Straight the globe preserving current center -- totally optional and has nothing to do with markers map.StraightenGlobe(); // UI Setup - non-important, only for this demo GUIResizer.Init(800, 500); labelStyle = new GUIStyle(); labelStyle.normal.textColor = Color.white; buttonStyle = new GUIStyle(labelStyle); buttonStyle.alignment = TextAnchor.MiddleLeft; buttonStyle.normal.background = Texture2D.whiteTexture; buttonStyle.normal.textColor = Color.white; sliderStyle = new GUIStyle(); sliderStyle.normal.background = Texture2D.whiteTexture; sliderStyle.fixedHeight = 4.0f; sliderThumbStyle = new GUIStyle(); sliderThumbStyle.normal.background = Resources.Load <Texture2D> ("thumb"); sliderThumbStyle.overflow = new RectOffset(0, 0, 8, 0); sliderThumbStyle.fixedWidth = 20.0f; sliderThumbStyle.fixedHeight = 12.0f; }
private void Start() { gameManager = interfaceFactory.GameManager; globeManager = interfaceFactory.GlobeManager; errorHandler = interfaceFactory.ErrorHandler; if (gameManager == null || globeManager == null || errorHandler == null) { gameObject.SetActive(false); } else { worldMapGlobe = globeManager.WorldMapGlobe; if (worldMapGlobe == null) { errorHandler.ReportError("World Map Globe missing", ErrorState.restart_scene); } playerManager = gameManager.PlayerManager; if (playerManager == null) { errorHandler.ReportError("Player Manager missing", ErrorState.restart_scene); } SetGlobeSettings(); started = true; } }
void Start() { labelStyle = new GUIStyle(); labelStyle.normal.textColor = Color.white; buttonStyle = new GUIStyle(labelStyle); buttonStyle.alignment = TextAnchor.MiddleLeft; buttonStyle.normal.background = Texture2D.whiteTexture; buttonStyle.normal.textColor = Color.white; sliderStyle = new GUIStyle(); sliderStyle.normal.background = Texture2D.whiteTexture; sliderStyle.fixedHeight = 4.0f; sliderThumbStyle = new GUIStyle(); sliderThumbStyle.normal.background = Resources.Load <Texture2D> ("thumb"); sliderThumbStyle.overflow = new RectOffset(0, 0, 8, 0); sliderThumbStyle.fixedWidth = 20.0f; sliderThumbStyle.fixedHeight = 12.0f; // setup GUI resizer - only for the demo GUIResizer.Init(800, 500); // Get map instance to Globe API methods map = WorldMapGlobe.instance; map.OnDrag += ClearFoW; // Load prefab GameObject tower = Resources.Load <GameObject>("Tower/Tower"); // Colorize some countries for (int colorizeIndex = 0; colorizeIndex < map.countries.Length; colorizeIndex++) { Country country = map.countries[colorizeIndex]; if (country.continent.Equals("Europe")) { // Color country surface Color color = new Color(UnityEngine.Random.Range(0.0f, 1.0f), UnityEngine.Random.Range(0.0f, 1.0f), UnityEngine.Random.Range(0.0f, 1.0f), 0.2f); map.ToggleCountrySurface(country.name, true, color); // Clear fog around the country map.SetFogOfWarAlpha(country, 0, 0.1f); // Add a random moving sphere for this country GameObject obj = GameObject.CreatePrimitive(PrimitiveType.Sphere); obj.transform.SetParent(map.transform, false); obj.transform.localScale = Vector3.one * 0.02f; obj.transform.localPosition = country.sphereCenter; obj.AddComponent <AnimateSphereAround>(); // Set a random color for the sphere obj.GetComponent <Renderer>().material.color = new Color(Random.value, Random.value, Random.value); // Add a tower on the center of the country GameObject thisTower = Instantiate(tower); map.AddMarker(thisTower, country.sphereCenter, 0.15f, false, 0, true); } } // Center on Paris map.FlyToCity(map.GetCity("France", "Paris")); }
void Start() { if (GetComponent <Collider2D>() == null) { gameObject.AddComponent <BoxCollider2D>(); } map = WorldMapGlobe.instance; }
void Start() { controller = controlador.GetLeapController(); map = WorldMapGlobe.instance; polo = GameObject.Find("Polo"); canvasPrincipal = GameObject.Find("CanvasPrincipal"); canvasQuiz = GameObject.Find("CanvasQuiz"); }
void Start() { Debug.Log("This script contains code for sorting cities based on different criteria. Double click here to examine the code"); map = WorldMapGlobe.instance; SortCitiesByPopulation(); SortCitiesByLatitude(); }
void Awake() { // Get a reference to the World Map API: map = WorldMapGlobe.instance; #if LIGHTSPEED Camera.main.fieldOfView = 180; animatingField = true; #endif }
void Start() { // Get a reference to the World Map API: map = WorldMapGlobe.instance; #if LIGHTSPEED Camera.main.fieldOfView = 180; animatingField = true; #endif map.earthInvertedMode = false; // UI Setup - non-important, only for this demo labelStyle = new GUIStyle(); labelStyle.alignment = TextAnchor.MiddleCenter; labelStyle.normal.textColor = Color.white; labelStyleShadow = new GUIStyle(labelStyle); labelStyleShadow.normal.textColor = Color.black; buttonStyle = new GUIStyle(labelStyle); buttonStyle.alignment = TextAnchor.MiddleLeft; buttonStyle.normal.background = Texture2D.whiteTexture; buttonStyle.normal.textColor = Color.white; colorPicker = gameObject.GetComponent <ColorPicker> (); sliderStyle = new GUIStyle(); sliderStyle.normal.background = Texture2D.whiteTexture; sliderStyle.fixedHeight = 4.0f; sliderThumbStyle = new GUIStyle(); sliderThumbStyle.normal.background = Resources.Load <Texture2D> ("thumb"); sliderThumbStyle.overflow = new RectOffset(0, 0, 8, 0); sliderThumbStyle.fixedWidth = 20.0f; sliderThumbStyle.fixedHeight = 12.0f; // setup GUI resizer - only for the demo GUIResizer.Init(800, 500); // Some example commands below // map.ToggleCountrySurface("Brazil", true, Color.green); // map.ToggleCountrySurface(35, true, Color.green); // map.ToggleCountrySurface(33, true, Color.green); // map.FlyToCountry(33); // map.FlyToCountry("Brazil"); // map.navigationTime = 0; // jump instantly to next country // map.FlyToCountry ("India"); /* Register events: this is optionally but allows your scripts to be informed instantly as the mouse enters or exits a country, province or city */ map.OnCityEnter += (int cityIndex) => Debug.Log("Entered city " + map.cities [cityIndex].name); map.OnCityExit += (int cityIndex) => Debug.Log("Exited city " + map.cities [cityIndex].name); map.OnCityClick += (int cityIndex) => Debug.Log("Clicked city " + map.cities [cityIndex].name); map.OnCountryEnter += (int countryIndex, int regionIndex) => Debug.Log("Entered country " + map.countries [countryIndex].name); map.OnCountryExit += (int countryIndex, int r1024egionIndex) => Debug.Log("Exited country " + map.countries [countryIndex].name); map.OnCountryClick += (int countryIndex, int regionIndex) => Debug.Log("Clicked country " + map.countries [countryIndex].name); map.OnProvinceEnter += (int provinceIndex, int regionIndex) => Debug.Log("Entered province " + map.provinces [provinceIndex].name); map.OnProvinceExit += (int provinceIndex, int regionIndex) => Debug.Log("Exited province " + map.provinces [provinceIndex].name); map.OnProvinceClick += (int provinceIndex, int regionIndex) => Debug.Log("Clicked province " + map.provinces [provinceIndex].name); map.OnClick += (sphereLocation, mouseButtonIndex) => Debug.Log("Clicked on sphere position " + sphereLocation); }
void SortCitiesByPopulation() { WorldMapGlobe map = WorldMapGlobe.instance; List <City> sortedCities = new List <City>(map.cities); sortedCities.Sort(PopulationComparer); Debug.Log("Less populated city: " + sortedCities[0].fullName); Debug.Log("Most populated city: " + sortedCities[sortedCities.Count - 1].fullName); }
void SortCitiesByLatitude() { WorldMapGlobe map = WorldMapGlobe.instance; List <City> sortedCities = new List <City>(map.cities); sortedCities.Sort(LatitudeComparer); Debug.Log("Southernmost city: " + sortedCities[0].fullName); Debug.Log("Northernmost city: " + sortedCities[sortedCities.Count - 1].fullName); }
void UpdateLatitudeLongitude() { WorldMapGlobe map = WorldMapGlobe.instance; if (map == null) { return; } latlonPending = false; _latlon = Conversion.GetLatLonFromSpherePoint(unitySphereLocation); }
protected override void Start() { base.Start(); if (gameObject.activeSelf) { globeManager = interfaceFactory.GlobeManager; uiManager = interfaceFactory.UIManager; if (globeManager == null || uiManager == null) { gameObject.SetActive(false); } else { worldMapGlobe = globeManager.WorldMapGlobe; if (worldMapGlobe == null) { errorHandler.ReportError("World Map Globe Missing", ErrorState.restart_scene); } globeParser = globeManager.GlobeParser; if (globeParser == null) { errorHandler.ReportError("Globe Parser missing", ErrorState.restart_scene); } else { countryParser = globeParser.CountryParser; if (countryParser == null) { errorHandler.ReportError("Country Parser missing", ErrorState.restart_scene); } provinceParser = globeParser.ProvinceParser; if (provinceParser == null) { errorHandler.ReportError("Province Parser missing", ErrorState.restart_scene); } } cellCursorInterface = globeManager.CellCursorInterface; if (cellCursorInterface == null) { errorHandler.ReportError("Cell Cursor Interface missing", ErrorState.restart_scene); } else { cellClicker = cellCursorInterface.CellClicker; if (cellClicker == null) { errorHandler.ReportError("Cell Clicker missing", ErrorState.restart_scene); } } } } }
void Start() { labelStyle = new GUIStyle(); labelStyle.normal.textColor = Color.white; // setup GUI resizer - only for the demo GUIResizer.Init(800, 500); // Get map instance to Globe API methods map = WorldMapGlobe.instance; }
void Start() { trackedObj = GetComponent <SteamVR_TrackedObject> (); if (map == null) { map = WorldMapGlobe.instance; } if (map != null) { map.VREnabled = true; } }
void Start() { // Get a reference to the World Map API: map = WorldMapGlobe.instance; // UI Setup - non-important, only for this demo labelStyle = new GUIStyle(); labelStyle.alignment = TextAnchor.MiddleLeft; labelStyle.normal.textColor = Color.white; // setup GUI resizer - only for the demo GUIResizer.Init(800, 500); }
/* * public GameObject NYpoint; * * public GameObject NVietnam; * public GameObject SVietnam; */ // Use this for initialization void Start() { map = WorldMapGlobe.instance; Current = this; #if LIGHTSPEED //Camera.main.fieldOfView = 180; //animatingField = true; #endif map.earthInvertedMode = false; }
void Start() { if (map == null) { map = WorldMapGlobe.instance; } rt = GetComponent <RectTransform> (); SetCursorVisibility(false); // Check Event System existence if (EventSystem.current == null) { GameObject o = new GameObject("EventSystem"); o.AddComponent <EventSystem> (); o.AddComponent <StandaloneInputModule> (); } }
private void Start() { errorHandler = interfaceFactory.ErrorHandler; gameManager = interfaceFactory.GameManager; globeManager = interfaceFactory.GlobeManager; if (errorHandler == null || gameManager == null || globeManager == null) { gameObject.SetActive(false); } else { worldMapGlobe = globeManager.WorldMapGlobe; if (worldMapGlobe == null) { errorHandler.ReportError("World Map Globe missing", ErrorState.restart_scene); } } }
// Use this for initialization void Start() { WorldMapGlobe map = WorldMapGlobe.instance; // Gets France center in sphere coordinates int countryIndex = map.GetCountryIndex("France"); Vector3 countryCenter = map.countries[countryIndex].sphereCenter; // Center on France and set constraint around country center map.FlyToLocation(countryCenter, 0); map.constraintPosition = countryCenter; map.constraintAngle = 5f; map.constraintPositionEnabled = true; // Set zoom level and stop rotation map.SetZoomLevel(0.1f); map.autoRotationSpeed = 0f; }
private void Awake() { interfaceFactory = FindObjectOfType <InterfaceFactory>(); if (interfaceFactory == null) { gameObject.SetActive(false); } try { WorldMapGlobe = FindObjectOfType <WorldMapGlobe>(); if (WorldMapGlobe == null) { worldMapGlobeMissing = true; } GlobeParser = globeParserObject.GetComponent(typeof(IGlobeParser)) as IGlobeParser; if (GlobeParser == null) { componentMissing = true; } CellCursorInterface = cellCursorInterfaceObject.GetComponent(typeof(ICellCursorInterface)) as ICellCursorInterface; if (CellCursorInterface == null) { componentMissing = true; } GlobeEditor = globeEditorObject.GetComponent(typeof(IGlobeEditor)) as IGlobeEditor; if (GlobeEditor == null) { componentMissing = true; } MappablesManager = mappablesManagerObject.GetComponent(typeof(IMappablesManager)) as IMappablesManager; if (MappablesManager == null) { componentMissing = true; } } catch { componentMissing = true; } }
void OnEnable() { Texture2D tex = Resources.Load <Texture2D> ("WorldMapArea"); if (tex != null) { worldColors = tex.GetPixels32(); tmp = new Color32[worldColors.Length]; tw = tex.width; th = tex.height; worldTex = new Texture2D(tw, th, TextureFormat.RGBA32, false); } downloads = new DownloadSlot[MAX_CONCURRENT_DOWNLOADS]; map = WorldMapGlobe.instance; countryNames = map.GetCountryNames(true); ti = new TileInfo(0, 0, 0, 0, null); numTiles = GetNumberOfTiles(); GetDownloadedTilesCount(); }