Ejemplo n.º 1
0
        void LateUpdate()
        {
            //		bool condition = (Application.isMobilePlatform && Input.touchCount > 0) || (!Application.isMobilePlatform && (Input.GetMouseButton(0)|| Input.GetAxis("Mouse ScrollWheel") != 0));
            bool condition = (Application.isMobilePlatform && Input.touchCount > 0) || !Application.isMobilePlatform || rotateWithHeading;

            if (target && condition && !GOUtils.IsPointerOverUI())
            {
                updateOrbit(false);
            }
        }
Ejemplo n.º 2
0
        public void ApplyUV(List <Vector3> shape)
        {
            float xMax = 0, yMax = 0, xMin = 0, yMin = 0, min = 0;

            if (uvMappingStyle == GOUVMappingStyle.TopFitSidesFit ||
                uvMappingStyle == GOUVMappingStyle.TopCenteredSidesFit ||
                uvMappingStyle == GOUVMappingStyle.TopFitSidesRatio ||
                uvMappingStyle == GOUVMappingStyle.TopFitSidesSliced)
            {
                xMax = vertices.Max(v => v.x);
                yMax = vertices.Max(v => v.z);
                xMin = vertices.Min(v => v.x);
                yMin = vertices.Min(v => v.z);
                min  = Mathf.Min(xMax, yMax);
                SetShapeInfo(shape);
            }

            Vector2[] uvs = new Vector2[vertices.Length];
            for (int i = 0; i < uvs.Length; i++)
            {
                switch (uvMappingStyle)
                {
                case GOUVMappingStyle.TopAndSidesRepeated:
                case GOUVMappingStyle.TopRepeatedSidesStretched:
                case GOUVMappingStyle.TopRepeatedSidesFit:
                    uvs[i] = new Vector2(vertices[i].x, vertices[i].z) / 100;
                    break;

                case GOUVMappingStyle.TopFitSidesRatio:
                case GOUVMappingStyle.TopFitSidesFit:
                case GOUVMappingStyle.TopFitSidesSliced:
                    Vector3 p = vertices[i];
                    p      = GOUtils.RotatePointAroundPivot(p, center, -Vector3.up * angle);
                    uvs[i] = new Vector2((p.x - xMin) / (xMax - xMin), -((p.z - yMin) / (yMax - yMin)));
                    break;

                case GOUVMappingStyle.TopCenteredSidesFit:

                    Vector3 po = vertices[i];
                    po = GOUtils.RotatePointAroundPivot(po, center, -Vector3.up * angle);
                    float u = (po.x - xMin) / (xMax - xMin);
                    float v = -((po.z - yMin) / (yMax - yMin));
                    uvs[i] = new Vector2(u, v) - new Vector2(((xMax / min) - 1) / 2, ((yMax / min) - 1) / 2);    //- new Vector2(0.2f,0);
                    break;

                default:
                    break;
                }
            }
            uv = uvs;
        }
        void GPSLocationCheck()
        {
            status = Input.location.status;

            if (!useLocationServices)
            {
                if (Application.isEditor && useBannerInsideEditor)
                {
                    showBannerWithText(true, "GPS is disabled");
                }
            }
            else if (status == LocationServiceStatus.Failed)
            {
                showBannerWithText(true, "GPS signal not found");
            }
            else if (status == LocationServiceStatus.Stopped)
            {
                showBannerWithText(true, "GPS signal not found");
            }
            else if (status == LocationServiceStatus.Initializing)
            {
                showBannerWithText(true, "Waiting for GPS signal");
            }
            else if (status == LocationServiceStatus.Running)
            {
                if (Input.location.lastData.horizontalAccuracy > desiredAccuracy)
                {
                    showBannerWithText(true, "GPS signal is weak");
                }
                else
                {
                    showBannerWithText(false, "GPS signal ok!");

                    if (!IsOriginSet)
                    {
                        SetOrigin(new Coordinates(Input.location.lastData));
                    }
                    LocationInfo info = Input.location.lastData;
                    if (info.latitude != currentLocation.latitude || info.longitude != currentLocation.longitude)
                    {
                        currentLocation.updateLocation(Input.location.lastData);
                        if (onLocationChanged != null)
                        {
                            onLocationChanged.Invoke(currentLocation);
                        }
                    }
                    CheckMotionState(new Coordinates(Input.location.lastData));
                }
            }

            if (Application.platform == RuntimePlatform.WebGLPlayer)
            {
                changeLocationWASD();
            }
            if (!useLocationServices && (Application.isEditor || Application.platform == RuntimePlatform.WindowsPlayer) && demoLocation != DemoLocation.NoGPSTest && demoLocation != DemoLocation.SearchMode && !GOUtils.IsPointerOverUI() && motionMode != MotionMode.Avatar)
            {
                changeLocationWASD();
            }
        }