private Vector2 GetRawMoveVector() { Vector2 move = Vector2.zero; move.x = InputManager.GetAxisRaw(m_HorizontalAxis); move.y = InputManager.GetAxisRaw(m_VerticalAxis); if (InputManager.GetButtonDown(m_HorizontalAxis)) { if (move.x < 0) { move.x = -1f; } if (move.x > 0) { move.x = 1f; } } if (InputManager.GetButtonDown(m_VerticalAxis)) { if (move.y < 0) { move.y = -1f; } if (move.y > 0) { move.y = 1f; } } return(move); }
public override bool ShouldActivateModule() { if (!base.ShouldActivateModule()) { return(false); } var shouldActivate = m_ForceModuleActive; InputManager.GetButtonDown(m_SubmitButton); shouldActivate |= InputManager.GetButtonDown(m_CancelButton); shouldActivate |= !Mathf.Approximately(InputManager.GetAxisRaw(m_HorizontalAxis), 0.0f); shouldActivate |= !Mathf.Approximately(InputManager.GetAxisRaw(m_HorizontalAxis_2), 0.0f); shouldActivate |= !Mathf.Approximately(InputManager.GetAxisRaw(m_VerticalAxis), 0.0f); shouldActivate |= !Mathf.Approximately(InputManager.GetAxisRaw(m_VerticalAxis_2), 0.0f); shouldActivate |= (m_MousePosition - m_LastMousePosition).sqrMagnitude > 0.0f; shouldActivate |= InputManager.GetMouseButtonDown(0); for (int i = 0; i < InputManager.touchCount; ++i) { Touch input = InputManager.GetTouch(i); shouldActivate |= input.phase == TouchPhase.Began || input.phase == TouchPhase.Moved || input.phase == TouchPhase.Stationary; } return(shouldActivate); }
public override bool ShouldActivateModule() { if (!base.ShouldActivateModule()) { return(false); } var shouldActivate = InputManager.GetButtonDown(m_SubmitButton); shouldActivate |= InputManager.GetButtonDown(m_CancelButton); shouldActivate |= !Mathf.Approximately(InputManager.GetAxisRaw(m_HorizontalAxis), 0.0f); shouldActivate |= !Mathf.Approximately(InputManager.GetAxisRaw(m_VerticalAxis), 0.0f); shouldActivate |= (m_MousePosition - m_LastMousePosition).sqrMagnitude > 0.0f; shouldActivate |= InputManager.GetMouseButtonDown(0); return(shouldActivate); }
// Update is called once per frame void Update() { // Eu: The input is inverted because I'm stupid float h = -Input.GetAxisRaw("Horizontal", GetPlayerID()); float v = -Input.GetAxisRaw("Vertical", GetPlayerID()); Vector2 walkDir = new Vector2(h, v); if (walkDir.SqrMagnitude() > 0.1f * 0.1f) { this.walkDirection = walkDir; } else { this.walkDirection = new Vector2(0, 0); } this.jump = Input.GetButton("Jump", GetPlayerID()); //this.run = Input.GetButton("Run", GetPlayerID()); if (this.attack == false && Input.GetButton("Attack", GetPlayerID()) == true) { timeAttackDown = Time.time; this.attackDown = true; this.attackUp = false; } else if (this.attack == true && Input.GetButton("Attack", GetPlayerID()) == false) { this.attackUp = true; this.attackDown = false; } else { this.attackUp = false; this.attackDown = false; } this.attack = Input.GetButton("Attack", GetPlayerID()); }
private Vector2 GetRawMoveVector() { return(new Vector2(InputManager.GetAxisRaw(m_HorizontalAxis), InputManager.GetAxisRaw(m_VerticalAxis))); }