示例#1
0
    public override void PlayerControllerFixUpdate()
    {
        base.PlayerControllerFixUpdate();
        //需要需要输入控制需要对接机位
        if (IsInputController)
        {
            if (InputDevice.TurnLeft((int)playerIndex))
            {
                playerTurnDirect = PlayerTurnDirect.Turn_Left;
            }
            else if (InputDevice.TurnRight((int)playerIndex))
            {
                playerTurnDirect = PlayerTurnDirect.Turn_Right;
            }
            else
            {
                playerTurnDirect = PlayerTurnDirect.Turn_Mid;
            }
            //playerAccelerateSign = playerAIControler.accelerateMinValue + InputDevice.Accelerate((int)playerIndex);

            //Debug.Log("acc01 == " + InputDevice.Accelerate(0) + ", acc02 == " + InputDevice.Accelerate(1));
            if (InputDevice.Accelerate(0) <= 0.1f && InputDevice.Accelerate(1) <= 0.1f)
            {
                //两个玩家都不踩脚踏板时,使玩家保持在镜头边缘.
                playerAccelerateSign = -0.05f;
            }
            else
            {
                playerAccelerateSign = playerAIControler.mPlayerAccMinRecord + InputDevice.Accelerate((int)playerIndex);
            }

            if (InputDevice.ButtonFireDown((int)playerIndex))
            {
                if (!IsPlayerSystemForceAccelerateSign)
                {
                    StartSupSpeed();

                    Invoke("CloseSupSpeed", m_SupSpeedKeepTime);
                }
            }
        }

        if (myTransform.localPosition.x <= 0f &&
            !((RaceSceneControl)GameRoot.CurrentSceneControl).m_WaitMeUI[(int)playerIndex].activeInHierarchy)
        {
            ((RaceSceneControl)GameRoot.CurrentSceneControl).m_WaitMeUI[(int)playerIndex].SetActive(true);
            //播放"等等我"语言.
            SoundEffectPlayer.Play("WaitMe.wav");
        }

        if (myTransform.localPosition.x > 0f &&
            ((RaceSceneControl)GameRoot.CurrentSceneControl).m_WaitMeUI[(int)playerIndex].activeInHierarchy)
        {
            ((RaceSceneControl)GameRoot.CurrentSceneControl).m_WaitMeUI[(int)playerIndex].SetActive(false);
        }
    }