コード例 #1
0
ファイル: GameManager.cs プロジェクト: uni101a/BolderingVR
    void Update()
    {
        //ゲーム開始. 以降の処理は全てゲーム開始後について
        if (!isStartedGame && climbingStatus.GetIsClimbing())
        {
            isStartedGame = true;
        }

        if (isStartedGame)
        {
            //どちらの手もホールドから離れたときゲームオーバー
            if (!climbingStatus.GetIsClimbing())
            {
                DestroySingleton();
                SceneManager.LoadScene("gameover");
                return;
            }

            //ホールドを握っている手のhpを変更
            if (GetControllerType(GetClimbingController()) == "left")
            {
                ReduceGrabbingHandsHP("left"); //握っている手のhpを減少
                HealHandsHP("right");          //握っていない手のhpを回復
            }
            if (GetControllerType(GetClimbingController()) == "right")
            {
                ReduceGrabbingHandsHP("right");
                HealHandsHP("left");
            }
        }
    }
コード例 #2
0
    void Update()
    {
        if (climbingStatus.GetIsClimbing())
        {
            return;
        }

        //コントローラーを認識
        device = SteamVR_Controller.Input((int)trackedObject.index);
        //スティックの入力から視点を回転
        RotatePlayerView(device.GetAxis());
    }
コード例 #3
0
    void Update()
    {
        if (climbingStatus.GetIsClimbing())
        {
            return;
        }
        //コントローラーを認識
        device = SteamVR_Controller.Input((int)trackedObject.index);
        //コントローラーのスティックの入力を格納
        Vector2 controllerAxis = device.GetAxis();

        //スティックが入力されているとき
        if (controllerAxis != new Vector2(0f, 0f))
        {
            var velocity = GenerateVelocity(controllerAxis);
            MovePlayer(velocity);
        }
    }