Inheritance: UnityEngine.MonoBehaviour
示例#1
0
        void OnEnable()
        {
            if (instance == null)
            {
                instance = this;

                if (dontDestroyOnLoad)
                {
                    DontDestroyOnLoad(this);
                }
            }
            else if (this != instance)
            {
                isBeingDestroyed = true; //If destroying, we don't want to reset the InputManager
                Destroy(gameObject);
            }

            if (logDebugInfo)
            {
                Debug.Log("InControl (version " + InputManager.Version + ")");
                Logger.OnLogMessage += HandleOnLogMessage;
            }

            InputManager.InvertYAxis  = invertYAxis;
            InputManager.EnableXInput = enableXInput;
            InputManager.SetupInternal();

            foreach (var className in customProfiles)
            {
                var classType = Type.GetType(className);
                if (classType == null)
                {
                    Debug.LogError("Cannot find class for custom profile: " + className);
                }
                else
                {
                    var customProfileInstance = Activator.CreateInstance(classType) as UnityInputDeviceProfile;
                    InputManager.AttachDevice(new UnityInputDevice(customProfileInstance));
                }
            }

            if (dontDestroyOnLoad)
            {
                DontDestroyOnLoad(this);
            }
        }
示例#2
0
        void OnEnable()
        {
            if (originalInstance != null && originalInstance != this)
            {
                //Remove the duplicate
                Destroy(this.gameObject);
                return;
            }
            originalInstance = this;
            if (logDebugInfo)
            {
                Debug.Log("InControl (version " + InputManager.Version + ")");
                Logger.OnLogMessage += HandleOnLogMessage;
            }

            InputManager.InvertYAxis  = invertYAxis;
            InputManager.EnableXInput = enableXInput;
            InputManager.SetupInternal();

            foreach (var className in customProfiles)
            {
                var classType = Type.GetType(className);
                if (classType == null)
                {
                    Debug.LogError("Cannot find class for custom profile: " + className);
                }
                else
                {
                    var customProfileInstance = Activator.CreateInstance(classType) as UnityInputDeviceProfile;
                    InputManager.AttachDevice(new UnityInputDevice(customProfileInstance));
                }
            }

            if (dontDestroyOnLoad)
            {
                DontDestroyOnLoad(this);
            }
        }
示例#3
0
 public InputManager(
     Input.Factory inputFactory,
     InControl.InControlManager inControlManager)
 {
     this.inputFactory = inputFactory;
 }
        void OnEnable()
        {
            if (instance == null)
            {
                instance = this;

                if (dontDestroyOnLoad)
                {
                    DontDestroyOnLoad(this);
                }
            }
            else if (this != instance)
            {
                isBeingDestroyed = true; //If destroying, we don't want to reset the InputManager
                Destroy(gameObject);
            }

            if (logDebugInfo)
            {
                Debug.Log( "InControl (version " + InputManager.Version + ")" );
                Logger.OnLogMessage += HandleOnLogMessage;
            }

            InputManager.InvertYAxis = invertYAxis;
            InputManager.EnableXInput = enableXInput;
            InputManager.SetupInternal();

            foreach (var className in customProfiles)
            {
                var classType = Type.GetType( className );
                if (classType == null)
                {
                    Debug.LogError( "Cannot find class for custom profile: " + className );
                }
                else
                {
                    var customProfileInstance = Activator.CreateInstance( classType ) as UnityInputDeviceProfile;
                    InputManager.AttachDevice( new UnityInputDevice( customProfileInstance ) );
                }
            }

            if (dontDestroyOnLoad)
            {
                DontDestroyOnLoad( this );
            }
        }
示例#5
0
 // Use this for initialization
 void Start()
 {
     manager = GetComponent <InControl.InControlManager>();
 }