コード例 #1
0
 private void Update()
 {
     if (!m_Jump)
     {
         m_Jump = player.GetButton("Jump");
     }
 }
        // Fixed update is called in sync with physics
        private void FixedUpdate()
        {
            if (!isLocalPlayer)
            {
                return;
            }


            crouch = false;
            if (!escapeMenu || disableControls)
            {
                // read inputs
                h = player.GetAxis("WalkHorizontal") * (reverseControls ? -1 : 1);
                v = player.GetAxis("WalkVertical") * (reverseControls ? -1 : 1);

                // TODO: crouch input
                crouch  = player.GetButton("Crouch");
                m_Move  = new Vector3(h, 0, v) / 2;
                m_Move *= multiplyer;

                // TODO: run input
                // run speed multiplier
                if (player.GetButton("Run") && allowRunning)
                {
                    m_isRunning = true;
                    m_Move     *= 2.0f;
                }
                else
                {
                    m_isRunning = false;
                }
            }
            else
            {
                m_Move = Vector3.zero;
            }
            // pass all parameters to the character control script
            m_Character.Move(m_Move, crouch, m_Jump, escapeMenu);
            //m_Character.Fire(m_firing);
            m_Jump = false;
        }