Esempio n. 1
0
    // Use this for initialization
    void Start()
    {
        OnScreenUpperLeftCorner  = UpperLeftCorner.GetComponent <RectTransform>().position; //Get the 2 locations
        OnScreenLowerRightCorner = LowerRightCorner.GetComponent <RectTransform>().position;

        controller     = GameObject.Find("Controller").GetComponent <ControllerScript>();
        onScreenSize   = OnScreenLowerRightCorner - OnScreenUpperLeftCorner; //Calculate how much 1 pixel is in coordinates in the next couple of liens.
        deltaLatitude  = lowerRightLatitude - upperLeftLatitude;
        deltaLongitude = lowerRightLongitude - upperLeftLongitude;
        deltaWidth     = OnScreenLowerRightCorner.x - OnScreenUpperLeftCorner.x;
        deltaHeight    = OnScreenLowerRightCorner.y - OnScreenUpperLeftCorner.y;

        pixelSize.x = (float)(deltaWidth / deltaLongitude);
        pixelSize.y = (float)(deltaHeight / deltaLatitude);


        controller = GameObject.Find("Controller").GetComponent <ControllerScript>();
        for (int i = 0; i < controller.miniGPSDatabase.Length; i++)
        {
            if (controller.miniGPSDatabase[i] != null && controller.miniGPSDatabase[i] != "")
            {
                PlaceMarker(controller.miniGPSDatabase[i]); //Go through all the scanned stickers, and place a marker for each one of them.
            }
        }
        GPSLocation(); //Doesn't work because I don't even know why
        //PlaceMarker("52.360345 4.873639"); a test line.
    }
Esempio n. 2
0
        /// <summary>
        /// Creates a new flat object.
        /// </summary>
        /// <param name="position">Position of the object</param>
        /// <param name="azimuth">Azimuth</param>
        /// <param name="size">Size (width, lenght)</param>
        /// <param name="texture">Used texture</param>
        public FlatObject(PositionInTown position, double azimuth, Vector2 size, Texture2D texture)
            : base(position, azimuth, size)
        {
            this.texture = texture;
            vertices     = new VertexPositionNormalTexture[4];
            indexes      = new short[6];

            Vector2 textureUpperLeft  = new Vector2(0.0f, 0.0f);
            Vector2 textureUpperRight = new Vector2(1.0f, 0.0f);
            Vector2 textureLowerLeft  = new Vector2(0.0f, 1.0f);
            Vector2 textureLowerRight = new Vector2(1.0f, 1.0f);

            for (int i = 0; i < vertices.Length; i++)
            {
                vertices[i].Normal = Vector3.Up;
            }

            vertices[0].Position          = LowerLeftCorner.ToVector3(verticalPosition);
            vertices[0].TextureCoordinate = textureLowerLeft;
            vertices[1].Position          = UpperLeftCorner.ToVector3(verticalPosition);
            vertices[1].TextureCoordinate = textureUpperLeft;
            vertices[2].Position          = LowerRightCorner.ToVector3(verticalPosition);
            vertices[2].TextureCoordinate = textureLowerRight;
            vertices[3].Position          = UpperRightCorner.ToVector3(verticalPosition);
            vertices[3].TextureCoordinate = textureUpperRight;

            indexes[0] = 0;
            indexes[1] = 1;
            indexes[2] = 2;
            indexes[3] = 2;
            indexes[4] = 1;
            indexes[5] = 3;

            quadEffect = new BasicEffect(texture.GraphicsDevice);
            quadEffect.EnableDefaultLighting();
            quadEffect.TextureEnabled = true;
            quadEffect.Texture        = texture;
        }