Example #1
0
        /// <summary>
        /// Initializes ProInput
        /// If already initialized, destroys object
        /// Doesn't destroy on load
        /// </summary>
        private void Awake()
        {
            // Checks if is initialized

            // Initializes ProInput
            _proInput = this;
            DontDestroyOnLoad(gameObject);
            _enabledBindings = new Dictionary <string, InputObject>();
        }
Example #2
0
        /// <summary>
        /// Constructor for InputObject
        /// </summary>
        /// <param name="name">Name of the input</param>
        /// <param name="defaultValue">Default binding</param>
        public InputObject(string name, Key defaultValue)
        {
            var directory = $"{Application.persistentDataPath}/{BindingsFolder}";

            if (!System.IO.Directory.Exists(directory))
            {
                System.IO.Directory.CreateDirectory(directory);
            }

            _name       = name;
            _saveHandle = new SaveHandle <BKey>($"{BindingsFolder}/{name}_bind");

            var loadedData = _saveHandle.LoadData();

            _binding = loadedData ?? defaultValue;
            ProInput.RegisterInput(this);
        }