Beispiel #1
0
 public void AddNewInputHandlerType(InputHandlerType type)
 {
     if (!this.inputHandlerTypes.Contains(type))
     {
         type.TryAddHandlers(this);
         this.inputHandlerTypes.Add(type);
     }
 }
        /// <summary>
        /// Return input of target type.
        /// </summary>
        /// <typeparam name="InputHandlerType"></typeparam>
        /// <returns>Input of desired type.</returns>
        /// Guaranteed to return an input. If the desired input has not been
        /// instantiated, it will first be instantiated and then returned.
        public static InputHandlerType GetInput <InputHandlerType>() where InputHandlerType : class, IInputHandler, new()
        {
            IInputHandler returnValue;

            if (!Instance._inputHandlers.TryGetValue(typeof(InputHandlerType), out returnValue))
            {
                returnValue = new InputHandlerType();
                Instance._inputHandlers.Add(typeof(InputHandlerType), returnValue);
                IInputActionCollection source = GetControlSettings(returnValue.InputSourceType);
                returnValue.InputSource = source;
            }
            return(returnValue as InputHandlerType);
        }
Beispiel #3
0
        private void SetupGame(InputHandlerType inputHandlerType)
        {
            BindInputHandlerSignal.Dispatch(inputHandlerType);

            ShowSignal.Dispatch(ShowType.InGame);
        }