Example #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Reign.InputExButtonMap"/> class.
 /// </summary>
 /// <param name="type">Button Type.</param>
 /// <param name="player">Player input accepted.</param>
 /// <param name="name">Name from Unitys settings.</param>
 /// <param name="analogName">Analog name from Unitys settings.</param>
 /// <param name="analogPositive">Is analog button valid when value is positive.</param>
 public InputExButtonMap(ButtonTypes type, ControllerPlayers player, string name, string analogName, bool analogPositive)
 {
     this.Type           = type;
     this.Player         = player;
     this.Name           = name;
     this.AnalogName     = analogName;
     this.AnalogPositive = analogPositive;
 }
Example #2
0
        /// <summary>
        /// Gets if the button was let up
        /// </summary>
        /// <returns>Returns if valid or not</returns>
        /// <param name="type">Button Type.</param>
        /// <param name="player">Player input accepted.</param>
        public static bool GetButtonUp(ButtonTypes type, ControllerPlayers player)
        {
            InputExButtonMap mapping;
            string           name = findButtonName(type, player, out mapping);

            if (mapping != null && mapping.analogUp)
            {
                return(true);
            }

            return(Input.GetButtonUp(name));
        }
Example #3
0
        private static string findAnalogName(AnalogTypes type, ControllerPlayers player)
        {
            foreach (var map in AnalogMappings)
            {
                if (map.Type == type && map.Player == player)
                {
                    return(map.Name);
                }
            }

            Debug.LogError(string.Format("Failed to find Analog {0} for Player {1}", type, player));
            return("Unknown");
        }
Example #4
0
        private static string findButtonName(ButtonTypes type, ControllerPlayers player, out InputExButtonMap mapping)
        {
            foreach (var map in ButtonMappings)
            {
                if (map.Type == type && map.Player == player)
                {
                    mapping = map;
                    return(map.Name);
                }
            }

            Debug.LogError(string.Format("Failed to find Button {0} for Player {1}", type, player));
            mapping = null;
            return("Unknown");
        }
Example #5
0
 /// <summary>
 /// Gets the Analog Axis value with no tolerance
 /// </summary>
 /// <returns>The axis.</returns>
 /// <param name="type">Analog Type.</param>
 /// <param name="player">Player input accepted.</param>
 public static float GetAxisRaw(AnalogTypes type, ControllerPlayers player)
 {
     return(Input.GetAxisRaw(findAnalogName(type, player)));
 }
Example #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Reign.InputExAnalogMap"/> class.
 /// </summary>
 /// <param name="type">Analog Type.</param>
 /// <param name="player">Player input accepted.</param>
 /// <param name="name">Button name defined in Unitys settings.</param>
 public InputExAnalogMap(AnalogTypes type, ControllerPlayers player, string name)
 {
     this.Type   = type;
     this.Player = player;
     this.Name   = name;
 }
Example #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Reign.InputExButtonMap"/> class.
 /// </summary>
 /// <param name="type">Button Type.</param>
 /// <param name="player">Player input accepted.</param>
 /// <param name="name">Name from Unitys settings.</param>
 public InputExButtonMap(ButtonTypes type, ControllerPlayers player, string name)
 {
     this.Type   = type;
     this.Player = player;
     this.Name   = name;
 }
Example #8
0
		private static string findAnalogName(AnalogTypes type, ControllerPlayers player)
		{
			foreach (var map in AnalogMappings)
			{
				if (map.Type == type && map.Player == player)
				{
					return map.Name;
				}
			}

			Debug.LogError(string.Format("Failed to find Analog {0} for Player {1}", type, player));
			return "Unknown";
		}
Example #9
0
		/// <summary>
		/// Gets the Analog Axis value with no tolerance
		/// </summary>
		/// <returns>The axis.</returns>
		/// <param name="type">Analog Type.</param>
		/// <param name="player">Player input accepted.</param>
		public static float GetAxisRaw(AnalogTypes type, ControllerPlayers player)
		{
			return Input.GetAxisRaw(findAnalogName(type, player));
		}
Example #10
0
		/// <summary>
		/// Gets if the button was let up
		/// </summary>
		/// <returns>Returns if valid or not</returns>
		/// <param name="type">Button Type.</param>
		/// <param name="player">Player input accepted.</param>
		public static bool GetButtonUp(ButtonTypes type, ControllerPlayers player)
		{
			InputExButtonMap mapping;
			string name = findButtonName(type, player, out mapping);
			if (mapping != null && mapping.analogUp) return true;

			return Input.GetButtonUp(name);
		}
Example #11
0
		private static string findButtonName(ButtonTypes type, ControllerPlayers player, out InputExButtonMap mapping)
		{
			foreach (var map in ButtonMappings)
			{
				if (map.Type == type && map.Player == player)
				{
					mapping = map;
					return map.Name;
				}
			}

			Debug.LogError(string.Format("Failed to find Button {0} for Player {1}", type, player));
			mapping = null;
			return "Unknown";
		}
Example #12
0
		/// <summary>
		/// Initializes a new instance of the <see cref="Reign.InputExAnalogMap"/> class.
		/// </summary>
		/// <param name="type">Analog Type.</param>
		/// <param name="player">Player input accepted.</param>
		/// <param name="name">Button name defined in Unitys settings.</param>
		public InputExAnalogMap(AnalogTypes type, ControllerPlayers player, string name)
		{
			this.Type = type;
			this.Player = player;
			this.Name = name;
		}
Example #13
0
		/// <summary>
		/// Initializes a new instance of the <see cref="Reign.InputExButtonMap"/> class.
		/// </summary>
		/// <param name="type">Button Type.</param>
		/// <param name="player">Player input accepted.</param>
		/// <param name="name">Name from Unitys settings.</param>
		/// <param name="analogName">Analog name from Unitys settings.</param>
		/// <param name="analogPositive">Is analog button valid when value is positive.</param>
		public InputExButtonMap(ButtonTypes type, ControllerPlayers player, string name, string analogName, bool analogPositive)
		{
			this.Type = type;
			this.Player = player;
			this.Name = name;
			this.AnalogName = analogName;
			this.AnalogPositive = analogPositive;
		}
Example #14
0
		/// <summary>
		/// Initializes a new instance of the <see cref="Reign.InputExButtonMap"/> class.
		/// </summary>
		/// <param name="type">Button Type.</param>
		/// <param name="player">Player input accepted.</param>
		/// <param name="name">Name from Unitys settings.</param>
		public InputExButtonMap(ButtonTypes type, ControllerPlayers player, string name)
		{
			this.Type = type;
			this.Player = player;
			this.Name = name;
		}