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();
        }
예제 #2
0
        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;
            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;
//			map.FlyToCountry ("India");
        }
        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;
        }
예제 #4
0
        // 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;
        }
예제 #5
0
        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();
        }
예제 #6
0
        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();
        }
예제 #7
0
        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"));
        }
예제 #8
0
        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 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;
        }
예제 #10
0
        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);
        }
예제 #11
0
        void Start()
        {
            labelStyle                        = new GUIStyle();
            labelStyle.alignment              = TextAnchor.MiddleCenter;
            labelStyle.normal.textColor       = Color.white;
            labelStyleShadow                  = new GUIStyle(labelStyle);
            labelStyleShadow.normal.textColor = Color.black;

            GUIResizer.Init(800, 500);

            tweet_icon = GameObject.Find("twitter");
            map        = WorldMapGlobe.instance;
            Tweet[] tweets = getTweetData();

            foreach (Tweet tweet in tweets)
            {
                TweetObject obj = new TweetObject(tweet);
                tweetObjects.Add(obj);
                addMarker(obj);
            }
        }