// Update is called once per frame void Update() { mRightAngle = SingletonAngle.GetInstance().RightAngle; mLeftAngle = SingletonAngle.GetInstance().LeftAngle; GetIndexFromPos(); GetSongNumFromPos(); StayJudge(); if (/*Input.mousePosition.x > Screen.width / 2 &&*/ mSongNum != mCurrentSongnum) { audio.Stop(); audio.clip = mSong_chorus[mSongNum]; mCurrentSongnum = mSongNum; } if (!audio.isPlaying /*&& Input.mousePosition.x > Screen.width / 2*/) { audio.Play(); } print(mRightAngle); }
// Update is called once per frame void Update() { //检测手部角度并设置状态 mShoulderAngle = SingletonAngle.GetInstance().RightAngle; if (mShoulderAngle < 50.0f && mShoulderAngle > 20.0f) { mIsGoOnSelected = true; } else { mIsGoOnSelected = false; } //print (shoulderAngle); //mIsGoOnSelected = true; //如果被选中,变化alpha值 if (mIsGoOnSelected) { //"继续游戏" GoOn2.guiTexture.color = new Color( GoOn2.guiTexture.color.r, GoOn2.guiTexture.color.g, GoOn2.guiTexture.color.b, mAlphaDirection * AlphaSpeed * Time.deltaTime + GoOn2.guiTexture.color.a ); //箭头 Arrow.guiTexture.color = new Color( Arrow.guiTexture.color.r, Arrow.guiTexture.color.g, Arrow.guiTexture.color.b, mAlphaDirection * AlphaSpeed * Time.deltaTime + Arrow.guiTexture.color.a ); if (GoOn2.guiTexture.color.a < AlphaLowerBound) { mAlphaDirection = 1.0f; } if (GoOn2.guiTexture.color.a > AlphaUpperBound) { mAlphaDirection = -1.0f; } if (GoOn2.transform.position.x <= 0.77) { mIsDirectionLeft = false; } if (GoOn2.transform.position.x >= 0.8) { mIsDirectionLeft = true; } if (mIsDirectionLeft) { GoOn2.transform.Translate(Vector3.left * LeftSpeed * Time.deltaTime); GoOn.transform.Translate(Vector3.left * LeftSpeed * Time.deltaTime); Arrow.transform.Translate(Vector3.left * LeftSpeed * Time.deltaTime); } else { GoOn2.transform.Translate(Vector3.right * RightSpeed * Time.deltaTime); GoOn.transform.Translate(Vector3.right * RightSpeed * Time.deltaTime); Arrow.transform.Translate(Vector3.right * RightSpeed * Time.deltaTime); } /*if(Arrow.guiTexture.color.a < AlphaLowerBound){ * mArrowDirection = 1.0f; * } * if(Arrow.guiTexture.color.a > AlphaUpperBound){ * mArrowDirection = -1.0f; * }*/ } //如果未被选中,将alpha值变化到下界 else { if (GoOn2.guiTexture.color.a > AlphaLowerBound) { GoOn2.guiTexture.color = new Color( GoOn2.guiTexture.color.r, GoOn2.guiTexture.color.g, GoOn2.guiTexture.color.b, -1.0f * AlphaSpeed * Time.deltaTime + GoOn2.guiTexture.color.a ); } if (Arrow.guiTexture.color.a > AlphaLowerBound) { Arrow.guiTexture.color = new Color( Arrow.guiTexture.color.r, Arrow.guiTexture.color.g, Arrow.guiTexture.color.b, -1.0f * AlphaSpeed * Time.deltaTime + Arrow.guiTexture.color.a ); } } }