Last active
August 29, 2015 14:15
-
-
Save CosmoCleaner/5679d6ff2965f55a1e14 to your computer and use it in GitHub Desktop.
Unity SampleAssets のバーチャルジョイスティック 動作テスト用スクリプト
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 UnityEngine; | |
using UnitySampleAssets.CrossPlatformInput; // CrossPlatformInputManager を含む名前空間 | |
public class VirtualJoystick : MonoBehaviour { | |
float x; | |
float y; | |
GUIStyle style; | |
void Awake() | |
{ | |
style = new GUIStyle(); | |
style.fontSize = 30; | |
} | |
void Update() | |
{ | |
// バーチャルジョイスティック(Joystick.cs)が CrossPlatformInputManager に投げた水平、垂直値を取得する | |
x = CrossPlatformInputManager.GetAxisRaw ("Horizontal"); | |
y = CrossPlatformInputManager.GetAxisRaw ("Vertical"); | |
} | |
void OnGUI() | |
{ | |
GUI.Label (new Rect (400, 300, 200, 50), "x : " + x, style); | |
GUI.Label (new Rect (400, 350, 200, 50), "y : " + y, style); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment