using System.Collections.Generic;
2.之後再宣告就可以使用嚕。
使用前記得要把變數new出來就是了。
//宣告 protected Dictionary<int, csBehaviorBase> m_dicObjBehaviors; //建立 m_dicObjBehaviors = new Dictionary<int, csBehaviorBase>();
using System.Collections.Generic;
//宣告 protected Dictionary<int, csBehaviorBase> m_dicObjBehaviors; //建立 m_dicObjBehaviors = new Dictionary<int, csBehaviorBase>();
using UnityEngine;
using System.Collections;
public class InputTest : MonoBehaviour {
protected float m_JoyX = 0.0f;
protected float m_JoyY = 0.0f;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update ()
{
m_JoyX = Input.GetAxis("Horizontal");
m_JoyY = Input.GetAxis("Vertical");
Debug.Log("Get Horizontal input from Joystick = " + m_JoyX.ToString());
Debug.Log("GetVertical input from Joystick = " + m_JoyY.ToString());
}
}
using UnityEngine;
using System.Collections;
public class InputTest : MonoBehaviour {
protected float m_JoyX = 0.0f;
protected float m_JoyY = 0.0f;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update ()
{
m_JoyX = Input.GetAxis("Horizontal");
m_JoyY = Input.GetAxis("Vertical");
if( Input.GetButton("Horizontal") )
{
Debug.Log("Get Horizontal input from Joystick = " + m_JoyX.ToString());
}else if(Input.GetButton("Vertical")) {
Debug.Log("GetVertical input from Joystick = " + m_JoyY.ToString());
}
if( Input.GetKey(KeyCode.JoystickButton11) ){
print("Get Joystick Button 0");
}
//Debug.Log("Get Horizontal input from Joystick = " + m_JoyX.ToString());
}
}
using UnityEngine;
using System.Collections;
public class InputTest : MonoBehaviour {
protected float m_JoyX = 0.0f;
protected float m_JoyY = 0.0f;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update ()
{
m_JoyX = Input.GetAxis("Horizontal_Joy");
m_JoyY = Input.GetAxis("Vertical_Joy");
if( Input.GetButton("Horizontal") )
{
print("Get Horizontal input from keyboard = " + Input.GetAxis("Horizontal").ToString());
}else if( Input.GetButton("Vertical") ){
print("Get Vertical input from keyboard = " + Input.GetAxis("Vertical").ToString());
}else if( Input.GetButton("Horizontal_Joy") ){//m_JoyX != 0.0f ){
Debug.Log("GetHorizontal input from Joystick = " + m_JoyX.ToString());
}else if( m_JoyY != 0.0f ){
Debug.Log("GetVertical input from Joystick = " + m_JoyY.ToString());
}
if( Input.GetKey(KeyCode.JoystickButton11) ){
print("Get Joystick Button 0");
}
}
}
Build docker image from multiple build contexts ...