// Start is called before the first frame update void Start() { instance = this; }
void Update() { #region Not null instances if (userInputMobileIntance == null) { userInputMobileIntance = UserInputMobile.instance; } if (userInputPcIntance == null) { userInputPcIntance = UserInputPC.instance; } if (uiControlerInstance == null) { uiControlerInstance = UIController.instance; } #endregion if (!userInputMobileIntance.isPressingTouch && !userInputPcIntance.isPressingKeys) // Reseta varariaveis de movimento se estiver parado { walkingLeft = false; walkingRight = false; if (isGrounded) { rb.velocity = new Vector2(0, rb.velocity.y); } } if (!isGrounded) { // Reduz a velocidade se não ta clicando pra andar ReduceVelocityIfNotClicking(); } else { if (!blockLoop) // Proíbe o pulo de resetar no momento do pulo { firstJump = false; } } #region Jump if (fRemenberJump >= 0) // Pulo timer { fRemenberJump -= Time.deltaTime; } if (userInputPcIntance.upKey | jumpTap) { fRemenberJump = fRemenberJumpTime; jumpTap = false; userInputPcIntance.upKey = false; } // Pulo if (fRemenberJump > 0) { Jump(); if (!firstJump) { fRemenberJump = 0; } } #endregion MovimentsMobile(); MovimentsPC(); PersonDontSlide(); IsTappedToJump(); IsGroundedFunc(); } // End Update