Esempio n. 1
0
		public static string ButtonNameToString(PlayerType playerType, InputButtonNames buttonName){
			if (playerType == PlayerType.Explo){
				if (buttonName == InputButtonNames.Action){
					return "P1_Action";
				}
				else if (buttonName == InputButtonNames.Jump){
					return "P1_Jump";
				}
				else if (buttonName == InputButtonNames.Toss){
					return "P1_Toss";
				}
				else if (buttonName == InputButtonNames.Door){
					return "P1_Door";
				}
				else if (buttonName == InputButtonNames.Pause){
					return "P1_Pause";
				}
				else if (buttonName == InputButtonNames.ToggleCamera){
					return "P1_ToggleCamera";
				}
				else{
					return "P1_Restart";
				}
			}
			else {
				if (buttonName == InputButtonNames.Action){
					return "P2_Action";
				}
				else if (buttonName == InputButtonNames.Jump){
					return "P2_Jump";
				}
				else if (buttonName == InputButtonNames.Toss){
					return "P2_Toss";
				}
				else if (buttonName == InputButtonNames.Door){
					return "P2_Door";
				}
				else if (buttonName == InputButtonNames.Pause){
					return "P2_Pause";
				}
				else if (buttonName == InputButtonNames.ToggleCamera){
					return "P2_ToggleCamera";
				}
				else {
					return "P2_Restart";
				}
			}
		}
Esempio n. 2
0
 protected void ReadKeyState(InputButtonNames button, KeyCode keyCode)
 {
     if (Input.GetKeyDown(keyCode))
     {
         buttons [(int)button].pressStartTime = Time.time;
         buttons [(int)button].pressState     = InputButtonPressState.Down;
     }
     else if (Input.GetKeyUp(keyCode))
     {
         buttons [(int)button].pressState = InputButtonPressState.Up;
     }
     else if (Input.GetKey(keyCode))
     {
         buttons [(int)button].pressState = InputButtonPressState.Pressed;
     }
 }
Esempio n. 3
0
 protected void ReadButtonState(InputButtonNames button, string buttonName)
 {
     if (Input.GetButtonDown(buttonName))
     {
         buttons [(int)button].pressStartTime = Time.time;
         buttons [(int)button].pressState     = InputButtonPressState.Down;
     }
     else if (Input.GetButtonUp(buttonName))
     {
         buttons [(int)button].pressState = InputButtonPressState.Up;
     }
     else if (Input.GetButton(buttonName))
     {
         buttons [(int)button].pressState = InputButtonPressState.Pressed;
     }
 }
Esempio n. 4
0
 public bool GetButtonClick(InputButtonNames button)
 {
     return(initialized && buttons [(int)button].pressState == InputButtonPressState.Up && (Time.time - buttons [(int)button].pressStartTime) < clickTime);
 }
Esempio n. 5
0
 public bool GetButtonUp(InputButtonNames button)
 {
     return(initialized && buttons [(int)button].pressState == InputButtonPressState.Up);
 }
Esempio n. 6
0
 public bool GetButton(InputButtonNames button)
 {
     return(initialized && (buttons [(int)button].pressState == InputButtonPressState.Pressed || buttons[(int)button].pressState == InputButtonPressState.Down));
 }