Here are the examples of the csharp api class UnityEngine.Input.GetButtonDown(string) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
61 Examples
0
1. Example
Project: Memoria
Source File: StandaloneInputModule.cs
Source File: StandaloneInputModule.cs
protected bool SendSubmitEventToSelectedObject() { if (eventSystem.currentSelectedGameObject == null) return false; var data = GetBaseEventData(); if (Input.GetButtonDown(m_SubmitButton)) ExecuteEvents.Execute(eventSystem.currentSelectedGameObject, data, ExecuteEvents.submitHandler); if (Input.GetButtonDown(m_CancelButton)) ExecuteEvents.Execute(eventSystem.currentSelectedGameObject, data, ExecuteEvents.cancelHandler); return data.used; }
0
2. Example
Project: gl-bits
Source File: StandaloneInput.cs
Source File: StandaloneInput.cs
public override bool GetButtonDown(string name) { return Input.GetButtonDown(name); }
0
3. Example
Project: Unity-5.x-Animation-Cookbook
Source File: SimpleMove.cs
Source File: SimpleMove.cs
void Update() { /*We check if player pressed the "Jump" button. We need to do it in the Update function instead of the FixedUpdate, because FixedUpdate has the tendency to lose GetButtonDown input*/ if (Input.GetButtonDown("Jump")) { //If player presses the "Jump" button, we store it in the jump flag jump = true; } }
0
4. Example
Project: Rotorcross
Source File: StandaloneInput.cs
Source File: StandaloneInput.cs
public override bool GetButtonDown(string name) { return Input.GetButtonDown(name); }
0
5. Example
Project: sdsandbox
Source File: StandaloneInput.cs
Source File: StandaloneInput.cs
public override bool GetButtonDown(string name) { return Input.GetButtonDown(name); }
0
6. Example
Project: Uniject
Source File: UnityInput.cs
Source File: UnityInput.cs
public bool GetButtonDown(string name) { return Input.GetButtonDown(name); }
0
7. Example
Project: unity3d-ui
Source File: StandaloneInputModule.cs
Source File: StandaloneInputModule.cs
private bool SendSubmitEventToSelectedObject() { if (eventSystem.currentSelectedGameObject == null) return false; var data = GetBaseEventData(); if (Input.GetButtonDown(m_SubmitButton)) ExecuteEvents.Execute(eventSystem.currentSelectedGameObject, data, ExecuteEvents.submitHandler); if (Input.GetButtonDown(m_CancelButton)) ExecuteEvents.Execute(eventSystem.currentSelectedGameObject, data, ExecuteEvents.cancelHandler); return data.used; }
0
8. Example
Project: unity3d-ui
Source File: StandaloneInputModule.cs
Source File: StandaloneInputModule.cs
private bool AllowMoveEventProcessing(float time) { bool allow = Input.GetButtonDown(m_HorizontalAxis); allow |= Input.GetButtonDown(m_VerticalAxis); allow |= (time > m_NextAction); return allow; }
0
9. Example
Project: UnityHello
Source File: UnityEngine_InputWrap.cs
Source File: UnityEngine_InputWrap.cs
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int GetButtonDown(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); string arg0 = ToLua.CheckString(L, 1); bool o = UnityEngine.Input.GetButtonDown(arg0); LuaDLL.lua_pushboolean(L, o); return 1; } catch(Exception e) { return LuaDLL.toluaL_exception(L, e); } }
0
10. Example
Project: Memoria
Source File: Input.cs
Source File: Input.cs
public static Boolean GetButtonDown(String keyName) { Boolean buttonDown = UnityEngine.Input.GetButtonDown(keyName); if (buttonDown) return buttonDown; return Input.GetXButtonDown(keyName); }
0
11. Example
Project: Memoria
Source File: StandaloneInputModule.cs
Source File: StandaloneInputModule.cs
private Vector2 GetRawMoveVector() { Vector2 move = Vector2.zero; move.x = Input.GetAxisRaw(m_HorizontalAxis); move.y = Input.GetAxisRaw(m_VerticalAxis); if (Input.GetButtonDown(m_HorizontalAxis)) { if (move.x < 0) move.x = -1f; if (move.x > 0) move.x = 1f; } if (Input.GetButtonDown(m_VerticalAxis)) { if (move.y < 0) move.y = -1f; if (move.y > 0) move.y = 1f; } return move; }
0
12. Example
Project: Yugioh-For-HoloLens
Source File: PlayerManager.cs
Source File: PlayerManager.cs
void ProcessInputs() { if (Input.GetButtonDown ("Fire1") ) { // we don't want to fire when we interact with UI buttons for example. IsPointerOverGameObject really means IsPointerOver*UI*GameObject // notice we don't use on on GetbuttonUp() few lines down, because one can mouse down, move over a UI element and release, which would lead to not lower the isFiring Flag. if (EventSystem.current.IsPointerOverGameObject ()) { // return; } if (!IsFiring) { IsFiring = true; } } if (Input.GetButtonUp ("Fire1") ) { if (IsFiring) { IsFiring = false; } } }
0
13. Example
Project: tango-examples-unity
Source File: PlayerManager.cs
Source File: PlayerManager.cs
void ProcessInputs() { if (Input.GetButtonDown("Fire1")) { // we don't want to fire when we interact with UI buttons for example. IsPointerOverGameObject really means IsPointerOver*UI*GameObject // notice we don't use on on GetbuttonUp() few lines down, because one can mouse down, move over a UI element and release, which would lead to not lower the isFiring Flag. if (EventSystem.current.IsPointerOverGameObject()) { // return; } if (!this.IsFiring) { this.IsFiring = true; } } if (Input.GetButtonUp("Fire1")) { if (this.IsFiring) { this.IsFiring = false; } } }
0
14. Example
Project: MixedRealityCompanionKit
Source File: JoystickStateManager.cs
Source File: JoystickStateManager.cs
public override bool ShouldSubmit() { return (UnityEngine.Input.GetButtonDown(this.SubmitButton) || (this.UseKeyboard && UnityEngine.Input.GetKeyDown(this.SubmitKey))); }
0
15. Example
Project: MixedRealityCompanionKit
Source File: JoystickStateManager.cs
Source File: JoystickStateManager.cs
public override bool ShouldCancel() { return (UnityEngine.Input.GetButtonDown(this.CancelButton) || (this.UseKeyboard && UnityEngine.Input.GetKeyDown(this.CancelKey))); }
0
16. Example
Project: MixedRealityCompanionKit
Source File: JoystickStateManager.cs
Source File: JoystickStateManager.cs
public override bool IsPressed(PointerEventData.InputButton button) { bool isPressed = false; switch (button) { case PointerEventData.InputButton.Left: isPressed = (UseKeyboard && UnityEngine.Input.GetKeyDown(this.LeftKey)) || UnityEngine.Input.GetButtonDown(this.LeftButton); break; case PointerEventData.InputButton.Middle: isPressed = (UseKeyboard && UnityEngine.Input.GetKeyDown(this.MiddleKey)) || UnityEngine.Input.GetButtonDown(this.MiddleButton); break; case PointerEventData.InputButton.Right: isPressed = (UseKeyboard && UnityEngine.Input.GetKeyDown(this.RightKey)) || UnityEngine.Input.GetButtonDown(this.RightButton); break; } return isPressed; ; }
0
17. Example
Project: MixedRealityCompanionKit
Source File: JoystickStateManager.cs
Source File: JoystickStateManager.cs
private Vector2 GetRawMoveVector(Stick whichStick) { Vector2 move = GetJoystickOffset(whichStick); if (UnityEngine.Input.GetButtonDown(this.HorizontalAxis)) { if (move.x < 0.0f) { move.x = -1.0f; } if (move.x > 0.0f) { move.x = 1.0f; } } if (UnityEngine.Input.GetButtonDown(this.VerticalAxis)) { if (move.y < 0.0f) { move.y = -1.0f; } if (move.y > 0.0f) { move.y = 1.0f; } } return move; }
0
18. Example
Project: MixedRealityCompanionKit
Source File: GamepadInput.cs
Source File: GamepadInput.cs
private void Update() { // TODO: Should this handle Submit from Edit > ProjectSettings > Input ? // Raise the air tap event when A button is pressed. if (Input.GetButtonDown(GamePadButtonA)) { Debug.Log("Gamepad A worked!"); inputManager.RaiseInputClicked(this, GamePadId, 1); } }
0
19. Example
Project: Silphid.Unity
Source File: CustomInputModule.cs
Source File: CustomInputModule.cs
protected bool SendSubmitEventToSelectedObject() { if (eventSystem.currentSelectedGameObject == null) return false; var data = GetBaseEventData(); if (Input.GetButtonDown(m_SubmitButton)) ExecuteBubbling(eventSystem.currentSelectedGameObject, data, ExecuteEvents.submitHandler); if (Input.GetButtonDown(m_CancelButton)) ExecuteBubbling(eventSystem.currentSelectedGameObject, data, ExecuteEvents.cancelHandler); return data.used; }
0
20. Example
Project: Silphid.Unity
Source File: CustomInputModule.cs
Source File: CustomInputModule.cs
private Vector2 GetRawMoveVector() { var move = Vector2.zero; move.x = Input.GetAxisRaw(m_HorizontalAxis); move.y = Input.GetAxisRaw(m_VerticalAxis); if (Input.GetButtonDown(m_HorizontalAxis)) { if (move.x < 0) move.x = -1f; if (move.x > 0) move.x = 1f; } if (Input.GetButtonDown(m_VerticalAxis)) { if (move.y < 0) move.y = -1f; if (move.y > 0) move.y = 1f; } return move; }
0
21. Example
Project: unity3d-ui
Source File: StandaloneInputModule.cs
Source File: StandaloneInputModule.cs
private Vector2 GetRawMoveVector() { Vector2 move = Vector2.zero; move.x = Input.GetAxisRaw(m_HorizontalAxis); move.y = Input.GetAxisRaw(m_VerticalAxis); if (Input.GetButtonDown(m_HorizontalAxis)) { if (move.x < 0) move.x = -1f; if (move.x > 0) move.x = 1f; } if (Input.GetButtonDown(m_VerticalAxis)) { if (move.y < 0) move.y = -1f; if (move.y > 0) move.y = 1f; } return move; }
0
22. Example
Project: battle-circle-ai
Source File: TitleMenu.cs
Source File: TitleMenu.cs
void Update () { if(Input.GetButtonDown("Attack_1")) { Application.LoadLevel(Application.loadedLevel+1); } }
0
23. Example
Project: MixedRealityToolkit-Unity
Source File: GamepadInput.cs
Source File: GamepadInput.cs
private void HandleGamepadAPressed() { // TODO: Should this handle Submit from Edit > ProjectSettings > Input ? if (Input.GetButtonDown(GamePadButtonA)) { inputManager.RaiseSourceDown(this, GamePadId, InteractionSourcePressInfo.Select); isAPressed = true; navigationCompleted = false; currentGestureState = GestureState.APressed; } if (isAPressed) { HandleNavigation(); if (!holdStarted && !raiseOnce && !navigationStarted) { // Raise hold started when user has held A down for certain interval. Invoke("HandleHoldStarted", HoldStartedInterval); } // Check if we get a subsequent release on A. HandleGamepadAReleased(); } }
0
24. Example
Project: MRDesignLabs_Unity_PeriodicTable
Source File: GamepadInput.cs
Source File: GamepadInput.cs
private void HandleGamepadAPressed() { // TODO: Should this handle Submit from Edit > ProjectSettings > Input ? if (Input.GetButtonDown(GamePadButtonA)) { inputManager.RaiseSourceDown(this, GamePadId, InteractionSourcePressInfo.Select); isAPressed = true; navigationCompleted = false; currentGestureState = GestureState.APressed; } if (isAPressed) { HandleNavigation(); if (!holdStarted && !raiseOnce && !navigationStarted) { // Raise hold started when user has held A down for certain interval. Invoke("HandleHoldStarted", HoldStartedInterval); } // Check if we get a subsequent release on A. HandleGamepadAReleased(); } }
0
25. Example
Project: Memoria
Source File: StandaloneInputModule.cs
Source File: StandaloneInputModule.cs
public override bool ShouldActivateModule() { if (!base.ShouldActivateModule()) return false; var shouldActivate = m_ForceModuleActive; Input.GetButtonDown(m_SubmitButton); shouldActivate |= Input.GetButtonDown(m_CancelButton); shouldActivate |= !Mathf.Approximately(Input.GetAxisRaw(m_HorizontalAxis), 0.0f); shouldActivate |= !Mathf.Approximately(Input.GetAxisRaw(m_VerticalAxis), 0.0f); shouldActivate |= (m_MousePosition - m_LastMousePosition).sqrMagnitude > 0.0f; shouldActivate |= Input.GetMouseButtonDown(0); return shouldActivate; }
0
26. Example
Project: Memoria
Source File: StandaloneInputModule.cs
Source File: StandaloneInputModule.cs
protected bool SendMoveEventToSelectedObject() { float time = Time.unscaledTime;/n ..... /n //View Source file for more details /n }
0
27. Example
Project: MixedRealityCompanionKit
Source File: JoystickStateManager.cs
Source File: JoystickStateManager.cs
public override bool ShouldActivate() { bool shouldActivate = false; shouldActivate |= UnityEngine.Input.GetButtonDown(this.SubmitButton); shouldActivate |= this.UseKeyboard && UnityEngine.Input.GetKeyDown(this.SubmitKey); shouldActivate |= UnityEngine.Input.GetButtonDown(this.CancelButton); shouldActivate |= this.UseKeyboard && UnityEngine.Input.GetKeyDown(this.CancelKey); shouldActivate |= !Mathf.Approximately(UnityEngine.Input.GetAxisRaw(this.HorizontalAxis), 0.0f); shouldActivate |= !Mathf.Approximately(UnityEngine.Input.GetAxisRaw(this.VerticalAxis), 0.0f); return shouldActivate; }
0
28. Example
Project: MixedRealityCompanionKit
Source File: JoystickStateManager.cs
Source File: JoystickStateManager.cs
public override bool ShouldMove(out Vector2 movement) { float time = Time.unscal/n ..... /n //View Source file for more details /n }
0
29. Example
Project: MixedRealityToolkit-Unity
Source File: XboxControllerInputSource.cs
Source File: XboxControllerInputSource.cs
protected override void Update() { base.Update(); // We will only r/n ..... /n //View Source file for more details /n }
0
30. Example
Project: MRDesignLabs_Unity_PeriodicTable
Source File: XboxControllerInputSource.cs
Source File: XboxControllerInputSource.cs
protected override void Update() { base.Update(); // We will only r/n ..... /n //View Source file for more details /n }
0
31. Example
Project: CodeLabs-GameDev-1-UnityIntro
Source File: PlayerController.cs
Source File: PlayerController.cs
void Update() { //TODO: Need to read player input here for Fire1 if (Input.GetButtonDown("Fire1")) { _animator.SetTrigger("Attack"); AttackLocalEnemies(); } //Read the left/right input _horizontal = Input.GetAxis("Horizontal"); _vertical = Input.GetAxis("Vertical"); //Flips the character left if the input is < 0 and 'normal right facing' if > 0 if (_horizontal > 0) { _spriteRenderer.flipX = true; } else if (_horizontal < 0) { _spriteRenderer.flipX = false; } //TODO: Play Walk animation if we've read input on the horizontal //_animator.SetBool("Walk", _horizontal != 0 || _vertical != 0); }
0
32. Example
Project: synthesis
Source File: JoystickInput.cs
Source File: JoystickInput.cs
public override float getInputDown(bool exactKeyModifiers = false, string axis = "", InputDevice device = InputDevice.Any) { if ( device != InputDevice.Any && device != InputDevice.Joystick || !checkModifiers(exactKeyModifiers) ) { return 0; } float sensitivity = 1; if ( axis != null && ( axis.Equals("Mouse X") || axis.Equals("Mouse Y") ) ) { sensitivity = 0.1f; } if (mButton != JoystickButton.None) { return Input.GetButtonDown(getInputName()) ? sensitivity : 0; } return getInputByAxis() * sensitivity; }
0
33. Example
Project: Silphid.Unity
Source File: CustomInputModule.cs
Source File: CustomInputModule.cs
public override bool ShouldActivateModule() { if (!base.ShouldActivateModule()) return false; var shouldActivate = m_ForceModuleActive; Input.GetButtonDown(m_SubmitButton); shouldActivate |= Input.GetButtonDown(m_CancelButton); shouldActivate |= !Mathf.Approximately(Input.GetAxisRaw(m_HorizontalAxis), 0.0f); shouldActivate |= !Mathf.Approximately(Input.GetAxisRaw(m_VerticalAxis), 0.0f); shouldActivate |= (m_MousePosition - m_LastMousePosition).sqrMagnitude > 0.0f; shouldActivate |= Input.GetMouseButtonDown(0); return shouldActivate; }
0
34. Example
Project: unity3d-ui
Source File: StandaloneInputModule.cs
Source File: StandaloneInputModule.cs
public override bool ShouldActivateModule() { if (!base.ShouldActivateModule()) return false; var shouldActivate = Input.GetButtonDown(m_SubmitButton); shouldActivate |= Input.GetButtonDown(m_CancelButton); shouldActivate |= !Mathf.Approximately(Input.GetAxisRaw(m_HorizontalAxis), 0.0f); shouldActivate |= !Mathf.Approximately(Input.GetAxisRaw(m_VerticalAxis), 0.0f); shouldActivate |= (m_MousePosition - m_LastMousePosition).sqrMagnitude > 0.0f; shouldActivate |= Input.GetMouseButtonDown(0); return shouldActivate; }
0
35. Example
Project: battle-circle-ai
Source File: Director.cs
Source File: Director.cs
void Update () { if(demoMode) { return; } if(!isGameOver) { healthGUI.text = (player.GetHealth() / 10).ToString(); if(player.GetHealth() <= 0) { StartCoroutine(OnGameOver()); } } else if(canQuit) { if(Input.GetButtonDown("Attack_1")) { Application.LoadLevel(0); } } }
0
36. Example
Project: CameraShake
Source File: BasicCharacterController.cs
Source File: BasicCharacterController.cs
private void UpdateMovement() { if (GetComponent<CharacterController>().isGrounded) { m_movement = new Vector3(Input.GetAxis("Horizontal"), 0.0f, Input.GetAxis("Vertical")); m_movement = MoveSpeed * transform.TransformDirection(m_movement); if (Input.GetButtonDown("Jump")) { m_movement.y = JumpSpeed; } } m_movement.y -= Gravity * Time.deltaTime; GetComponent<CharacterController>().Move(m_movement * Time.deltaTime); }
0
37. Example
Project: MRDesignLabs_Unity_LunarModule
Source File: DebugMenu.cs
Source File: DebugMenu.cs
private void Update() { #if !UNITY_METRO || UNITY_EDITOR if (Input.GetKeyDown(EditorOpenKey)) { Activate(); } else if (Input.GetKeyDown(EditorDownKey)) { Deactivate(); } #endif if (Input.GetButtonDown("360_RightBumper")) { if (m_MenuContainer.activeSelf) { Deactivate(); } else { Activate(); } } // Needs updating if (m_PageDirty) { for (int i = 0; i < m_PageKeys.Count; ++i) { DebugPage page; m_Pages.TryGetValue(m_PageKeys[i], out page); if (page) { page.gameObject.SetActive(i == m_CurrentPage); } } m_PageText.text = (m_CurrentPage + 1) + "/" + m_PageKeys.Count; m_PageDirty = false; } }
0
38. Example
Project: MRDesignLabs_Unity_Tools
Source File: DebugMenu.cs
Source File: DebugMenu.cs
private void Update() { #if !UNITY_METRO || UNITY_EDITOR if (Input.GetKeyDown(EditorOpenKey)) { Activate(); } else if (Input.GetKeyDown(EditorDownKey)) { Deactivate(); } #endif if (Input.GetButtonDown(LogToggleControllerMap)) { if (m_MenuContainer.activeSelf) { Deactivate(); } else { Activate(); } } // Needs updating if (m_PageDirty) { for (int i = 0; i < m_PageKeys.Count; ++i) { DebugPage page; m_Pages.TryGetValue(m_PageKeys[i], out page); if (page) { page.gameObject.SetActive(i == m_CurrentPage); } } m_PageText.text = (m_CurrentPage + 1) + "/" + m_PageKeys.Count; m_PageDirty = false; } }
0
39. Example
Project: CodeLabs-GameDev-2-UnityWin10
Source File: TankShooting.cs
Source File: TankShooting.cs
private void Update () { // The slider should have a default value of the minimu/n ..... /n //View Source file for more details /n }
0
40. Example
Project: CodeLabs-GameDev-2-UnityWin10
Source File: TankShooting.cs
Source File: TankShooting.cs
private void Update () { // The slider should have a default value of the minimu/n ..... /n //View Source file for more details /n }
0
41. Example
Project: CodeLabs-GameDev-1-UnityIntro
Source File: PlayerController.cs
Source File: PlayerController.cs
void Update() { //TODO: Need to read player input here for Fire1 if (Input.GetButtonDown("Fire1")) { _animator.SetTrigger("Attack"); AttackLocalEnemies(); } //Read the left/right input _horizontal = Input.GetAxis("Horizontal"); _vertical = Input.GetAxis("Vertical"); //Flips the character left if the input is < 0 and 'normal right facing' if > 0 if (_horizontal > 0) { _spriteRenderer.flipX = true; } else if (_horizontal < 0) { _spriteRenderer.flipX = false; } //TODO: Play Walk animation if we've read input on the horizontal _animator.SetBool("Walk", _horizontal != 0 || _vertical != 0); }
0
42. Example
Project: Silphid.Unity
Source File: CustomInputModule.cs
Source File: CustomInputModule.cs
protected bool SendMoveEventToSelectedObject() { float time = Time.unscaledTime;/n ..... /n //View Source file for more details /n }
0
43. Example
Project: MRDesignLabs_Unity_LunarModule
Source File: DebugLog.cs
Source File: DebugLog.cs
private void Update() { if (m_LogsToAdd.Count > 0) { m_LogContent.enabled = false; while (m_LogsToAdd.Count > 0) { KeyValuePair<string, LogType> log = m_LogsToAdd[0]; m_LogsToAdd.RemoveAt(0); this.AddLog(log.Key, log.Value); } m_LogContent.enabled = true; } if (m_GoToBottom) { m_GoToBottom = false; m_ScrollRect.verticalNormalizedPosition = 0; } #if !UNITY_METRO || UNITY_EDITOR if (Input.GetKeyDown(LogOpenKey)) { Activate(); } else if (Input.GetKeyDown(LogDownKey)) { Deactivate(); } #endif if (Input.GetButtonDown("360_LeftBumper")) { if (m_DebugLogObj.activeSelf) { Deactivate(); } else { Activate(); } } }
0
44. Example
Project: MRDesignLabs_Unity_Tools
Source File: DebugLog.cs
Source File: DebugLog.cs
private void Update() { if (m_LogsToAdd.Count > 0) { m_LogContent.enabled = false; while (m_LogsToAdd.Count > 0) { KeyValuePair<string, LogType> log = m_LogsToAdd[0]; m_LogsToAdd.RemoveAt(0); this.AddLog(log.Key, log.Value); } m_LogContent.enabled = true; } if (m_GoToBottom) { m_GoToBottom = false; m_ScrollRect.verticalNormalizedPosition = 0; } #if !UNITY_METRO || UNITY_EDITOR if (Input.GetKeyDown(LogOpenKey)) { Activate(); } else if (Input.GetKeyDown(LogCloseKey)) { Deactivate(); } #endif if (Input.GetButtonDown(LogToggleControllerMap)) { if (m_DebugLogObj.activeSelf) { Deactivate(); } else { Activate(); } } }
0
45. Example
Project: battle-circle-ai
Source File: DudeController.cs
Source File: DudeController.cs
public void FixedUpdate() //function Update() { if(disabled) return; if(cardinalMovement) /n ..... /n //View Source file for more details /n }
0
46. Example
Project: Yugioh-For-HoloLens
Source File: PlayerAnimatorManager.cs
Source File: PlayerAnimatorManager.cs
void Update () { // Prevent control is connected to Photon and represent the localPlayer if( photonView.isMine == false && PhotonNetwork.connected == true ) { return; } // failSafe is missing Animator component on GameObject if (!animator) { return; } // deal with Jumping AnimatorStateInfo stateInfo = animator.GetCurrentAnimatorStateInfo(0); // only allow jumping if we are running. if (stateInfo.IsName("Base Layer.Run")) { // When using trigger parameter if (Input.GetButtonDown("Fire2")) animator.SetTrigger("Jump"); } // deal with movement float h = Input.GetAxis("Horizontal"); float v = Input.GetAxis("Vertical"); // prevent negative Speed. if( v < 0 ) { v = 0; } // set the Animator Parameters animator.SetFloat( "Speed", h*h+v*v ); animator.SetFloat( "Direction", h, DirectionDampTime, Time.deltaTime ); }
0
47. Example
Project: tango-examples-unity
Source File: PlayerAnimatorManager.cs
Source File: PlayerAnimatorManager.cs
void Update () { // Prevent control is connected to Photon and represent the localPlayer if( photonView.isMine == false && PhotonNetwork.connected == true ) { return; } // failSafe is missing Animator component on GameObject if (!animator) { return; } // deal with Jumping AnimatorStateInfo stateInfo = animator.GetCurrentAnimatorStateInfo(0); // only allow jumping if we are running. if (stateInfo.IsName("Base Layer.Run")) { // When using trigger parameter if (Input.GetButtonDown("Fire2")) animator.SetTrigger("Jump"); } // deal with movement float h = Input.GetAxis("Horizontal"); float v = Input.GetAxis("Vertical"); // prevent negative Speed. if( v < 0 ) { v = 0; } // set the Animator Parameters animator.SetFloat( "Speed", h*h+v*v ); animator.SetFloat( "Direction", h, DirectionDampTime, Time.deltaTime ); }
0
48. Example
Project: Memoria
Source File: HonoInputManager.cs
Source File: HonoInputManager.cs
private void ScanKeySources() { this.ResetSources(); if (this.isDisablePrimaryKe/n ..... /n //View Source file for more details /n }
0
49. Example
Project: battle-circle-ai
Source File: SwordzPlayer.cs
Source File: SwordzPlayer.cs
void Update () { // if there are joysticks connected while in singleplayer mode (mouse controls),/n ..... /n //View Source file for more details /n }
0
50. Example
Project: UWO
Source File: IdleRunJump.cs
Source File: IdleRunJump.cs
void Update () { if (animator) { AnimatorStateInfo stateInfo = animator.GetCurrentAnimatorStateInfo(0); if (stateInfo.IsName("Base Layer.Run")) { if (Input.GetButton("Fire1")) animator.SetBool("Jump", true); } else { animator.SetBool("Jump", false); } if(Input.GetButtonDown("Fire2") && animator.layerCount >= 2) { animator.SetBool("Hi", !animator.GetBool("Hi")); } float h = Input.GetAxis("Horizontal"); float v = Input.GetAxis("Vertical"); animator.SetFloat("Speed", h*h+v*v); animator.SetFloat("Direction", h, DirectionDampTime, Time.deltaTime); } }