예제 #1
0
    void FixedUpdate()
    {
        UpdateController();
        UpdateLabels();

        OuyaExampleCommon.UpdateJoysticks();
    }
    public void Update()
    {
        if (null == m_texture)
        {
            return;
        }

        OuyaExampleCommon.UpdateJoysticks();

        UpdateTexture();

        if (m_timerTexture < DateTime.Now)
        {
            m_timerTexture = DateTime.Now + TimeSpan.FromMilliseconds(100);
            m_texture.SetPixels32(m_pixels);
            m_texture.Apply();
        }

        if (m_timerText < DateTime.Now)
        {
            m_timerText = DateTime.Now + TimeSpan.FromMilliseconds(1000);

            if (m_label)
            {
                UpdateCounts();
                m_label.text = string.Format("c={0} | u={1} | {2:F2}%",
                                             m_pixelCount, m_updatePixelCount, m_pixelRatio * 100);
            }
        }
    }
    private void FixedUpdate()
    {
        OuyaExampleCommon.UpdateJoysticks();

        if (RendererLabel)
        {
            RendererLabel.text = m_items.Count.ToString();
        }

        if (PolysLabel)
        {
            int count = 0;
            foreach (MeshFilter mf in m_items)
            {
                if (mf.mesh)
                {
                    count += mf.mesh.vertexCount;
                }
            }
            PolysLabel.text = count.ToString();
        }

        if (m_timerChange < DateTime.Now)
        {
            m_timerChange = DateTime.Now + TimeSpan.FromMilliseconds(200);

            if (OuyaExampleCommon.GetButton(OuyaSDK.OuyaPlayer.player1, OuyaSDK.KeyEnum.BUTTON_DPAD_LEFT))
            {
                DecreaseGeometry(1f);
            }

            if (OuyaExampleCommon.GetButton(OuyaSDK.OuyaPlayer.player1, OuyaSDK.KeyEnum.BUTTON_DPAD_RIGHT))
            {
                IncreaseGeometry(1f);
            }

            if (OuyaExampleCommon.GetButton(OuyaSDK.OuyaPlayer.player1, OuyaSDK.KeyEnum.BUTTON_DPAD_UP))
            {
                CombineGeometry();
            }

            if (OuyaExampleCommon.GetButton(OuyaSDK.OuyaPlayer.player1, OuyaSDK.KeyEnum.BUTTON_O))
            {
                IncreaseGeometry(0.1f);
            }

            if (OuyaExampleCommon.GetButton(OuyaSDK.OuyaPlayer.player1, OuyaSDK.KeyEnum.BUTTON_A))
            {
                DecreaseGeometry(0.1f);
            }
        }

        float x = OuyaExampleCommon.GetAxis("LY", OuyaSDK.OuyaPlayer.player1);
        float y = OuyaExampleCommon.GetAxis("LX", OuyaSDK.OuyaPlayer.player1);

        Camera.main.transform.RotateAround(new Vector3(0, 0, 3), Camera.main.transform.rotation * Vector3.right, x * 45 * Time.fixedDeltaTime);
        Camera.main.transform.RotateAround(new Vector3(0, 0, 3), Camera.main.transform.rotation * Vector3.up, y * 45 * Time.fixedDeltaTime);
    }
예제 #4
0
    void FixedUpdate()
    {
        if (Active)
        {
            if (MasterAlpha < 0.999f && triggeredForward)
            {
                triggeredBack = false;
                MasterAlpha  += 0.01f;
                if (MasterVolume < 1)
                {
                    MasterVolume += 0.05f;
                    audio.volume  = MasterVolume;
                }
            }
            else if (doNotFadeLastImage && currentPage + 1 == SplashPages.Length)
            {
                Active       = false;
                isSplashPage = false;
                LoadScene();
            }
            else if (MasterAlpha > 0.001f && triggeredBack)
            {
                triggeredForward = false;
                MasterAlpha     -= 0.01f;
            }
            else if (triggeredForward && MasterAlpha > 0.999f)
            {
                triggeredForward = false;
                triggeredBack    = true;
            }
            else if (triggeredBack && MasterAlpha < 0.001f)
            {
                StartCoroutine(PauseTime());
            }

            if (currentPage < SplashPages.Length)
            {
                Color color = SplashPages[currentPage].color;
                color.a = MasterAlpha;
                SplashPages[currentPage].color = color;
            }
            else
            {
                Active       = false;
                isSplashPage = false;
                StartCoroutine(LoadScene());
            }
        }

        DetectControllers();

        if (MogaInput.GetControllerState() == MogaController.ACTION_CONNECTED)
        {
            if ((MogaInput.GetControllerSupportedVersion() == MogaController.ACTION_VERSION_MOGAPRO) && (!InputManager.Moga))
            {
                InputManager.Moga = true;
                MogaPro           = true;
                //ControllerCount = 1;
                //Controllers = ["MogaPro Controller"];
            }
            else if ((MogaInput.GetControllerSupportedVersion() == MogaController.ACTION_VERSION_MOGA) && (!InputManager.Moga))
            {
                InputManager.Moga = true;
                MogaPro           = false;
                //ControllerCount = 1;
                //Controllers = ["Moga Controller"];
            }
        }
        else
        {
            InputManager.Moga = false;
//			if(Controllers[0] == "MogaPro Controller" || Controllers[0] == "Moga Controller")
//			{
//			//Controllers = null;
//			//ControllerCount =0;
//			}
        }

        OuyaExampleCommon.UpdateJoysticks();

        //Debug.Log(SystemInfo.deviceModel);


        if (SwappingSound)
        {
            if (audio.clip != audioToSwapTo && MusicVolumeFloat > 0)
            {
                MusicVolumeFloat -= 0.05f;
                audio.volume      = MusicVolumeFloat;
                //Debug.Log("music volume " + MusicVolumeFloat);
            }
            else if (MusicVolumeFloat <= 0 && audio.clip != audioToSwapTo)
            {
                audio.clip = audioToSwapTo;
                if (!audio.isPlaying)
                {
                    audio.Play();
                }
                //	Debug.Log("swapped audio clip");
            }
            else if (MusicVolumeFloat < 1 && audio.clip == audioToSwapTo)
            {
                MusicVolumeFloat += 0.05f;
                audio.volume      = MusicVolumeFloat;
                if (!audio.isPlaying)
                {
                    audio.Play();
                }
                //Debug.Log("swapping " + MusicVolumeFloat);
            }
            else if (MusicVolumeFloat >= 1 && audio.clip == audioToSwapTo && audio.isPlaying)
            {
                SwappingSound = false;
                //	Debug.Log("swapping OFF");
            }
        }


        if (CountDownTimer <= TimeTrial && WW3DIsUnlocked && !gameIsUnlocked)
        {
            CountDownTimer += Time.deltaTime;
            TimeRemaining   = TimeTrial - CountDownTimer;
            interval       += Time.deltaTime;

            //	Debug.Log("time remianing "+TimeRemaining + " " + TimeTrial + " - " + CountDownTimer);

            if (interval > 10)
            {
                PlayerPrefs.SetFloat("CountDownTime", CountDownTimer);
                PlayerPrefs.Save();
                interval = 0;
            }
        }
        else if (WW3DIsUnlocked && !gameIsUnlocked)
        {
            WW3DIsUnlocked = false;
            PlayerPrefs.SetFloat("CountDownTime", CountDownTimer);
            PlayerPrefs.Save();
        }
    }