/// <summary> /// Inputのインターフェースを作成 /// </summary> /// <param name="id">ユーザーID</param> /// <param name="type">入力のタイプ</param> /// <returns>作成成功か?</returns> public static bool CreateInterface(UserID id, XVInputType type) { int i = (int)id; switch (type) { case XVInputType.None: XLogger.LogWarning("Create interface= XVInputNone: id= " + i.ToString()); m_input[i] = new XVInputNone(); break; case XVInputType.Keyboard: XLogger.Log("Create interface= XVInputKeyboard: id= " + i.ToString()); m_input[i] = new XVInputKeyboard(); break; case XVInputType.Controller: #if DEBUG if (XVInput.GetConnectedNum() == 0) { if (id == UserID.User1) { m_input[i] = new XVInputKeyboard(); XLogger.LogWarning("Debug Create interface= XVInputKeyboard: id= " + i.ToString()); return(true); } } #endif XLogger.Log("Create interface= XVInputController: id= " + i.ToString()); m_input[i] = new XVInputController(id); break; } return(true); }
void Update() { float delta = Time.deltaTime; float angle = 0.0f; IXVInput input = XVInput.GetInterface(UserID.User1); UpdatePosition(); if (m_slerpTime >= m_autoRotateTime) { angle = input.RotateCameraH() * m_rotateSpeed * delta; if (angle != 0.0f) { m_pivot.Rotate(Vector3.up, angle); } if (Input.GetKeyDown(KeyCode.U)) // TODO { m_slerpTime = 0.0f; } } else { m_slerpTime = (m_slerpTime + Time.deltaTime); m_pivot.rotation = Quaternion.Slerp(m_pivot.rotation, m_target.rotation, m_autoRotateSpeed * Time.deltaTime); } }
// Use this for initialization void Start() { XVInput.ClearInterface(); m_nextUserId = 0; m_time = m_startWaitTime; EnableMeshAnimation(0, false); EnableMeshAnimation(1, false); EnableMeshAnimation(2, false); EnableMeshAnimation(3, false); }
/// <summary> /// コントローラのAssign /// </summary> private void AssignController() { UnityAction <XBKeyCode.UserCode, UserID> act = (code, id) => { if (IsInputEvent(code)) { int idx = (int)id; if (!(m_isSubmitedUser[idx])) { m_isSubmitedUser[idx] = true; XVInput.CreateXBoxInterface((UserID)m_nextUserId, code); EnableUser(m_nextUserId); ++m_nextUserId; } } }; act.Invoke(XBKeyCode.UserCode.User1, UserID.User1); act.Invoke(XBKeyCode.UserCode.User2, UserID.User2); act.Invoke(XBKeyCode.UserCode.User3, UserID.User3); act.Invoke(XBKeyCode.UserCode.User4, UserID.User4); }
void Awake() { if (XVInput.GetConnectedNum() == 0) { XVInput.CreateInterface(UserID.User1, XVInputType.Keyboard); } else { string[] table = XVInput.GetConnectedNames(); XLogger.Log("Enumerate Controller"); foreach (string str in table) { XLogger.Log(str); } XVInput.CreateInterface(UserID.User1, XVInputType.Controller); } // TODO XVInput.CreateInterface(UserID.User2, XVInputType.None); XVInput.CreateInterface(UserID.User3, XVInputType.None); XVInput.CreateInterface(UserID.User4, XVInputType.None); }