Exemple #1
0
        private void Update()
        {
            float angle = 0;

            if (Input.acceleration != Vector3.zero)
            {
                switch (TiltAroundAxis)
                {
                case AxisOptions.ForwardAxis:
                    angle = Mathf.Atan2(Input.acceleration.x, -Input.acceleration.y) * Mathf.Rad2Deg +
                            CentreAngleOffset;
                    break;

                case AxisOptions.SidewaysAxis:
                    angle = Mathf.Atan2(Input.acceleration.z, -Input.acceleration.y) * Mathf.Rad2Deg +
                            CentreAngleOffset;
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }

            var axisValue = Mathf.InverseLerp(-FullTiltAngle, FullTiltAngle, angle) * 2 - 1;

            switch (Mapping.Type)
            {
            case AxisMapping.MappingType.NamedAxis:
                _mSteerAxis.Update(axisValue);
                break;

            case AxisMapping.MappingType.MousePositionX:
                CrossPlatformInputManager.SetVirtualMousePositionX(axisValue * Screen.width);
                break;

            case AxisMapping.MappingType.MousePositionY:
                CrossPlatformInputManager.SetVirtualMousePositionY(axisValue * Screen.width);
                break;

            case AxisMapping.MappingType.MousePositionZ:
                CrossPlatformInputManager.SetVirtualMousePositionZ(axisValue * Screen.width);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Exemple #2
0
        private void Update()
        {
            print(Input.acceleration);
            float angle = 0;

            if (Input.acceleration != Vector3.zero)
            {
                switch (tiltAroundAxis)
                {
                case AxisOptions.ForwardAxis:
                    angle = Mathf.Atan2(Input.acceleration.x, -Input.acceleration.y) * Mathf.Rad2Deg +
                            centreAngleOffset;
                    break;

                case AxisOptions.SidewaysAxis:
                    angle = Mathf.Atan2(Input.acceleration.z, -Input.acceleration.y) * Mathf.Rad2Deg +
                            centreAngleOffset;
                    break;
                }
            }

            float axisValue = Mathf.InverseLerp(-fullTiltAngle, fullTiltAngle, angle) * 2 - 1;

            switch (mapping.type)
            {
            case AxisMapping.MappingType.NamedAxis:
                m_SteerAxis.Update(axisValue);
                break;

            case AxisMapping.MappingType.MousePositionX:
                CrossPlatformInputManager.SetVirtualMousePositionX(axisValue * Screen.width);
                break;

            case AxisMapping.MappingType.MousePositionY:
                CrossPlatformInputManager.SetVirtualMousePositionY(axisValue * Screen.width);
                break;

            case AxisMapping.MappingType.MousePositionZ:
                CrossPlatformInputManager.SetVirtualMousePositionZ(axisValue * Screen.width);
                break;
            }
        }
        // Token: 0x06000ACA RID: 2762 RVA: 0x0003FBC8 File Offset: 0x0003DFC8
        private void Update()
        {
            float value = 0f;

            if (Input.acceleration != Vector3.zero)
            {
                TiltInput.AxisOptions axisOptions = this.tiltAroundAxis;
                if (axisOptions != TiltInput.AxisOptions.ForwardAxis)
                {
                    if (axisOptions == TiltInput.AxisOptions.SidewaysAxis)
                    {
                        value = Mathf.Atan2(Input.acceleration.z, -Input.acceleration.y) * 57.29578f + this.centreAngleOffset;
                    }
                }
                else
                {
                    value = Mathf.Atan2(Input.acceleration.x, -Input.acceleration.y) * 57.29578f + this.centreAngleOffset;
                }
            }
            float num = Mathf.InverseLerp(-this.fullTiltAngle, this.fullTiltAngle, value) * 2f - 1f;

            switch (this.mapping.type)
            {
            case TiltInput.AxisMapping.MappingType.NamedAxis:
                this.m_SteerAxis.Update(num);
                break;

            case TiltInput.AxisMapping.MappingType.MousePositionX:
                CrossPlatformInputManager.SetVirtualMousePositionX(num * (float)Screen.width);
                break;

            case TiltInput.AxisMapping.MappingType.MousePositionY:
                CrossPlatformInputManager.SetVirtualMousePositionY(num * (float)Screen.width);
                break;

            case TiltInput.AxisMapping.MappingType.MousePositionZ:
                CrossPlatformInputManager.SetVirtualMousePositionZ(num * (float)Screen.width);
                break;
            }
        }
        // Token: 0x0600746E RID: 29806 RVA: 0x0023A718 File Offset: 0x00238918
        private void OCMKCBBCEFG()
        {
            float value = 363f;

            if (Input.acceleration != Vector3.zero)
            {
                TiltInput.AxisOptions axisOptions = this.tiltAroundAxis;
                if (axisOptions != TiltInput.AxisOptions.ForwardAxis)
                {
                    if (axisOptions == TiltInput.AxisOptions.SidewaysAxis)
                    {
                        value = Mathf.Atan2(Input.acceleration.z, -Input.acceleration.y) * 1261f + this.centreAngleOffset;
                    }
                }
                else
                {
                    value = Mathf.Atan2(Input.acceleration.x, -Input.acceleration.y) * 1032f + this.centreAngleOffset;
                }
            }
            float num = Mathf.InverseLerp(-this.fullTiltAngle, this.fullTiltAngle, value) * 281f - 475f;

            switch (this.mapping.type)
            {
            case TiltInput.AxisMapping.MappingType.NamedAxis:
                this.BONEKGOJGEK.LLJLDLLNFBH(num);
                break;

            case TiltInput.AxisMapping.MappingType.MousePositionX:
                CrossPlatformInputManager.SetVirtualMousePositionX(num * (float)Screen.width);
                break;

            case TiltInput.AxisMapping.MappingType.MousePositionY:
                CrossPlatformInputManager.SetVirtualMousePositionY(num * (float)Screen.width);
                break;

            case TiltInput.AxisMapping.MappingType.MousePositionZ:
                CrossPlatformInputManager.SetVirtualMousePositionZ(num * (float)Screen.width);
                break;
            }
        }
        // Token: 0x0600749A RID: 29850 RVA: 0x0023B92C File Offset: 0x00239B2C
        private void EHCGBJDFMHG()
        {
            float value = 1557f;

            if (Input.acceleration != Vector3.zero)
            {
                TiltInput.AxisOptions axisOptions = this.tiltAroundAxis;
                if (axisOptions != TiltInput.AxisOptions.ForwardAxis)
                {
                    if (axisOptions == TiltInput.AxisOptions.SidewaysAxis)
                    {
                        value = Mathf.Atan2(Input.acceleration.z, -Input.acceleration.y) * 1837f + this.centreAngleOffset;
                    }
                }
                else
                {
                    value = Mathf.Atan2(Input.acceleration.x, -Input.acceleration.y) * 841f + this.centreAngleOffset;
                }
            }
            float num = Mathf.InverseLerp(-this.fullTiltAngle, this.fullTiltAngle, value) * 75f - 86f;

            switch (this.mapping.type)
            {
            case TiltInput.AxisMapping.MappingType.NamedAxis:
                this.BONEKGOJGEK.IBHACCEEFFI(num);
                break;

            case TiltInput.AxisMapping.MappingType.MousePositionX:
                CrossPlatformInputManager.SetVirtualMousePositionX(num * (float)Screen.width);
                break;

            case TiltInput.AxisMapping.MappingType.MousePositionY:
                CrossPlatformInputManager.SetVirtualMousePositionY(num * (float)Screen.width);
                break;

            case TiltInput.AxisMapping.MappingType.MousePositionZ:
                CrossPlatformInputManager.SetVirtualMousePositionZ(num * (float)Screen.width);
                break;
            }
        }
        // Token: 0x06007490 RID: 29840 RVA: 0x0023B7C8 File Offset: 0x002399C8
        private void JBNPEHMDCMI()
        {
            float value = 983f;

            if (Input.acceleration != Vector3.zero)
            {
                TiltInput.AxisOptions axisOptions = this.tiltAroundAxis;
                if (axisOptions != TiltInput.AxisOptions.ForwardAxis)
                {
                    if (axisOptions == TiltInput.AxisOptions.ForwardAxis)
                    {
                        value = Mathf.Atan2(Input.acceleration.z, -Input.acceleration.y) * 306f + this.centreAngleOffset;
                    }
                }
                else
                {
                    value = Mathf.Atan2(Input.acceleration.x, -Input.acceleration.y) * 216f + this.centreAngleOffset;
                }
            }
            float num = Mathf.InverseLerp(-this.fullTiltAngle, this.fullTiltAngle, value) * 1807f - 460f;

            switch (this.mapping.type)
            {
            case TiltInput.AxisMapping.MappingType.NamedAxis:
                this.BONEKGOJGEK.BGFJOEPFOPM(num);
                break;

            case TiltInput.AxisMapping.MappingType.MousePositionX:
                CrossPlatformInputManager.SetVirtualMousePositionX(num * (float)Screen.width);
                break;

            case TiltInput.AxisMapping.MappingType.MousePositionY:
                CrossPlatformInputManager.SetVirtualMousePositionY(num * (float)Screen.width);
                break;

            case TiltInput.AxisMapping.MappingType.MousePositionZ:
                CrossPlatformInputManager.SetVirtualMousePositionZ(num * (float)Screen.width);
                break;
            }
        }
        // Token: 0x0600747C RID: 29820 RVA: 0x0023AEF0 File Offset: 0x002390F0
        private void AIJGAJIOJDJ()
        {
            float value = 1315f;

            if (Input.acceleration != Vector3.zero)
            {
                TiltInput.AxisOptions axisOptions = this.tiltAroundAxis;
                if (axisOptions != TiltInput.AxisOptions.ForwardAxis)
                {
                    if (axisOptions == TiltInput.AxisOptions.ForwardAxis)
                    {
                        value = Mathf.Atan2(Input.acceleration.z, -Input.acceleration.y) * 305f + this.centreAngleOffset;
                    }
                }
                else
                {
                    value = Mathf.Atan2(Input.acceleration.x, -Input.acceleration.y) * 622f + this.centreAngleOffset;
                }
            }
            float num = Mathf.InverseLerp(-this.fullTiltAngle, this.fullTiltAngle, value) * 25f - 1224f;

            switch (this.mapping.type)
            {
            case TiltInput.AxisMapping.MappingType.NamedAxis:
                this.BONEKGOJGEK.JNBPKNNBMDI(num);
                break;

            case TiltInput.AxisMapping.MappingType.MousePositionX:
                CrossPlatformInputManager.SetVirtualMousePositionX(num * (float)Screen.width);
                break;

            case TiltInput.AxisMapping.MappingType.MousePositionY:
                CrossPlatformInputManager.SetVirtualMousePositionY(num * (float)Screen.width);
                break;

            case TiltInput.AxisMapping.MappingType.MousePositionZ:
                CrossPlatformInputManager.SetVirtualMousePositionZ(num * (float)Screen.width);
                break;
            }
        }
        // Token: 0x060074A1 RID: 29857 RVA: 0x0023BF6C File Offset: 0x0023A16C
        private void JOACBIEHHCE()
        {
            float value = 494f;

            if (Input.acceleration != Vector3.zero)
            {
                TiltInput.AxisOptions axisOptions = this.tiltAroundAxis;
                if (axisOptions != TiltInput.AxisOptions.ForwardAxis)
                {
                    if (axisOptions == TiltInput.AxisOptions.SidewaysAxis)
                    {
                        value = Mathf.Atan2(Input.acceleration.z, -Input.acceleration.y) * 546f + this.centreAngleOffset;
                    }
                }
                else
                {
                    value = Mathf.Atan2(Input.acceleration.x, -Input.acceleration.y) * 313f + this.centreAngleOffset;
                }
            }
            float num = Mathf.InverseLerp(-this.fullTiltAngle, this.fullTiltAngle, value) * 1938f - 1401f;

            switch (this.mapping.type)
            {
            case TiltInput.AxisMapping.MappingType.NamedAxis:
                this.BONEKGOJGEK.NKLIHNJCHOG(num);
                break;

            case TiltInput.AxisMapping.MappingType.MousePositionX:
                CrossPlatformInputManager.SetVirtualMousePositionX(num * (float)Screen.width);
                break;

            case TiltInput.AxisMapping.MappingType.MousePositionY:
                CrossPlatformInputManager.SetVirtualMousePositionY(num * (float)Screen.width);
                break;

            case TiltInput.AxisMapping.MappingType.MousePositionZ:
                CrossPlatformInputManager.SetVirtualMousePositionZ(num * (float)Screen.width);
                break;
            }
        }
        // Token: 0x0600749F RID: 29855 RVA: 0x0023BE2C File Offset: 0x0023A02C
        private void FABMDEHEDNO()
        {
            float value = 954f;

            if (Input.acceleration != Vector3.zero)
            {
                TiltInput.AxisOptions axisOptions = this.tiltAroundAxis;
                if (axisOptions != TiltInput.AxisOptions.ForwardAxis)
                {
                    if (axisOptions == TiltInput.AxisOptions.SidewaysAxis)
                    {
                        value = Mathf.Atan2(Input.acceleration.z, -Input.acceleration.y) * 1897f + this.centreAngleOffset;
                    }
                }
                else
                {
                    value = Mathf.Atan2(Input.acceleration.x, -Input.acceleration.y) * 638f + this.centreAngleOffset;
                }
            }
            float num = Mathf.InverseLerp(-this.fullTiltAngle, this.fullTiltAngle, value) * 1045f - 1536f;

            switch (this.mapping.type)
            {
            case TiltInput.AxisMapping.MappingType.NamedAxis:
                this.BONEKGOJGEK.NDAJBJFJGCF(num);
                break;

            case TiltInput.AxisMapping.MappingType.MousePositionX:
                CrossPlatformInputManager.SetVirtualMousePositionX(num * (float)Screen.width);
                break;

            case TiltInput.AxisMapping.MappingType.MousePositionY:
                CrossPlatformInputManager.SetVirtualMousePositionY(num * (float)Screen.width);
                break;

            case TiltInput.AxisMapping.MappingType.MousePositionZ:
                CrossPlatformInputManager.SetVirtualMousePositionZ(num * (float)Screen.width);
                break;
            }
        }