コード例 #1
0
ファイル: InputEx.cs プロジェクト: bufang-master/Adventure
 /// <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;
 }
コード例 #2
0
ファイル: InputEx.cs プロジェクト: bufang-master/Adventure
        /// <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));
        }
コード例 #3
0
ファイル: InputEx.cs プロジェクト: bufang-master/Adventure
        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");
        }
コード例 #4
0
ファイル: InputEx.cs プロジェクト: bufang-master/Adventure
        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");
        }
コード例 #5
0
ファイル: InputEx.cs プロジェクト: bufang-master/Adventure
 /// <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)));
 }
コード例 #6
0
ファイル: InputEx.cs プロジェクト: bufang-master/Adventure
 /// <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;
 }
コード例 #7
0
ファイル: InputEx.cs プロジェクト: bufang-master/Adventure
 /// <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;
 }
コード例 #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";
		}
コード例 #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));
		}
コード例 #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);
		}
コード例 #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";
		}
コード例 #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;
		}
コード例 #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;
		}
コード例 #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;
		}