コード例 #1
0
        // Update is called once per frame
        private void Update()
        {
            RotateView();

            // reset jump if grounded
            if (m_CharacterController.isGrounded)
            {
                m_CurrentJumpCount = 0;
            }

            // the jump state needs to read here to make sure it is not missed
            m_CanJump = CrossPlatformInputManager.GetButtonDown("Jump") && m_CurrentJumpCount < m_MaxJumps;

            if (m_CanJump)
            {
                m_CurrentJumpCount++;
            }

            // m_CanDash = CrossPlatformInputManager.GetButtonDown(KeyCode.W);
            if (CrossPlatformInputManager.GetKeyDown(KeyCode.W))
            {
                m_DoubleTapLastTapped = Time.time;
                if ((Time.time - m_DoubleTapLastTapped < m_DoubleTapDelay))
                {
                    Debug.Log("DASH bitch");
                }
            }

            if (!m_PreviouslyGrounded && m_CharacterController.isGrounded)
            {
                StartCoroutine(m_JumpBob.DoBobCycle());
                PlayLandingSound();
                m_MoveDir.y = 0f;
                m_IsJumping = false;
            }
            if (!m_CharacterController.isGrounded && !m_IsJumping && m_PreviouslyGrounded)
            {
                m_MoveDir.y = 0f;
            }

            m_Animator.SetBool("isGrounded", m_CharacterController.isGrounded);
            m_PreviouslyGrounded = m_CharacterController.isGrounded;
        }
コード例 #2
0
        void Update()
        {
            if (supportSwitch && CrossPlatformInputManager.GetKeyDown(KeyCode.Tab))
            {
                if (IsSwitching)
                {
                    return;
                }

                switch (ViewType)
                {
                case FollowViewType.First:
                    Switch(FollowViewType.Third);
                    break;

                case FollowViewType.Third:
                    Switch(FollowViewType.First);
                    break;
                }
            }
        }