Created
October 4, 2018 07:58
-
-
Save nabesi777/b83b2611af2eb26dfa7be14033aa812f to your computer and use it in GitHub Desktop.
BlueToothコントローラー動作テストスクリプト
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class Controll : MonoBehaviour { | |
// Use this for initialization | |
void Start () { | |
//スマホ画面上のXボタンを押すとアプリが終了 | |
Input.backButtonLeavesApp = true; | |
} | |
// Update is called once per frame | |
void Update () { | |
if (Input.GetButton("Fire1")) //Xボタンが割り当て | |
{//動作テストの為にCubeを回転させる | |
transform.Rotate(transform.rotation.eulerAngles + new Vector3(0f, 0.0f, 0.1f)); | |
} | |
//左スティックでCubeの移動 | |
float h = Input.GetAxis("Horizontal"); | |
float v = Input.GetAxis("Vertical"); | |
transform.position += new Vector3(h*0.1f, v * 0.1f, 0f); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment