// Update is called once per frame void Update() { float horz = Input.GetAxisRaw(HorzAxis); float j = Input.GetAxisRaw(JumpButton); if (j > .5f) { jump.Jump(); } else { jump.Fall(); } if (Math.Abs(horz) > 0.01f) { walk.Walk(horz); } else { walk.Stop(); } }
void CheckMove() { // Check jump if (grounded && jumpHandler.CheckJump()) { jumpHandler.Jump(currentRobot.jumpVelocity, currentRobot.positiveVelocityYBound); } // Triggers for animation if (move != 0) { animationRenderer.SetTrigger("RobotRun"); } else { animationRenderer.SetTrigger("RobotIdle"); } Vector2 velocityVector = new Vector2(move * currentRobot.maxSpeed, rb.velocity.y); rb.velocity = velocityVector; CheckFlip(); }
void CheckMove() { // Check jump if (_groundChecker.IsGrounded() && _jumpHandler.CheckJump()) { _jumpHandler.Jump(_currentRobot.jumpVelocity, _currentRobot.positiveVelocityYBound); } // Triggers for animation if (_move != 0) { animationRenderer.SetTrigger("RobotRun"); } else { animationRenderer.SetTrigger("RobotIdle"); } Vector2 velocityVector = new Vector2(_move * _currentRobot.maxSpeed, _rigidbody.velocity.y); _rigidbody.velocity = velocityVector; _flipChecker.CheckFlip(_move); }