void FixedUpdate() { int count = Input.touchCount; int touches = count; //Reconhece de zero a 2 toques na tela if (count == 0) { count = 1; } else if (count > 2) { count = 2; } for (int i = 0; i < count; i++) { //Player atacando, seja melee ou ranged if (attack) { //ranged attack if (longPressDetected) { if (Time.time - touchTime > castingDuration) { player.AttackRanged(direction); } else { player.CastRangedAttack(direction, 0f); } direction = new Vector2(0, 0); longPressDetected = false; touchTime = Time.time; //Impede que o player ataque duas vezes //melee attack } else { player.AttackMelee(); if (inTutorial) { GameObject attackTutorial = GameObject.Find("AttackTutorial(Clone)"); Destroy(attackTutorial); } } attack = false; //Reconhece um long press } else if (longPressDetected) { //Manda a direção que o player está mirando e o tempo que ficou pressionando o botao player.CastRangedAttack(direction, castingTime); //Pulo } else if (direction.y > 80 && normalizedDirection.x > -0.5f && normalizedDirection.x < 0.5f && !longPressDetected) { player.MovePlayer(new Vector2(0, 1)); direction = new Vector2(0, 0); //Movimentação } else { //Se não existir toque na tela pare o player if (touches == 0) { movement = new Vector2(0, 0); } player.MovePlayer(movement); } } }