Exemplo n.º 1
0
    // プレイヤーの動きに関する処理
    void MovePlayer()
    {
        stunAnimeTime -= Time.deltaTime;

        /*=================================================================
         * // ▼▼▼移動処理▼▼▼
         * //=================================================================*/
        if (stat.IsReload() == true)
        {
              // Reload時
            charaCtrl.Move(moveDirection *moveSpeed *Time.deltaTime *ReloadSpeedRatio);
        }
        else
        {
            charaCtrl.Move(moveDirection * moveSpeed * Time.deltaTime);
        }

        if (stunAnimeTime > 0F)
        {
            return;
        }

        //  テンキーや3Dスティックの入力(GetAxis)がゼロの時の動作
        //animCtr.SetBool("doMove", useMoveKey());

        //=================================================================
        // ▼▼▼ジャンプと落下の処理▼▼▼
        //=================================================================
        if (charaCtrl.isGrounded)    //CharacterControllerの付いているこのオブジェクトが接地している場合の処理
        {
            MoveOnGround();

            if (iController.GetJumpButton())   //ジャンプボタンが押されている場合
            {
                animCtr.SetTrigger("doJump");
                moveDirection.y = jumpPower; //Y方向への速度に「ジャンプパワー」の変数を代入する
                //SE_JUMP.Play();
                return;
            }
        }

        //マイナスのY方向(下向き)に重力を与える
        moveDirection.y -= gravity * Time.deltaTime;
    }