コード例 #1
0
        private IDevice CreateDevice(InputManager.InputType type, string inputName)
        {
            IDevice device = null;

            // create specific device subtype
            switch (type)
            {
            case InputManager.InputType.UnityInput:  device = new Device_UnityInput(); break;

            case InputManager.InputType.Keyboard:    device = new Device_Keyboard(); break;

#if !NO_MOCAP_INPUT
            case InputManager.InputType.MoCapDevice: device = new Device_MoCap(); break;
#endif
            default:
            {
                Debug.LogWarning("Input Type " + type.ToString() + " not supported.");
                break;
            }
            }
            // try to initialise given the parameter string
            if (device != null)
            {
                inputName = inputName.Trim();
                if (!device.Initialise(inputName))
                {
                    // failed
                    device = null;
                }
            }
            return(device);
        }