private void Attacc() { animator.SetFloat("Velocity", 0); if (!canattacc) { enemy.Animator.SetBool("Attack1", false); punchendtimer += Time.smoothDeltaTime; if (punchendtimer > 0.05f) { enemy.enemy_punch.enabled = false; } } attaccTimer += Time.deltaTime; if (attaccTimer >= difficultyUtils.attaccCooldown) { canattacc = true; attaccTimer = 0; } if (canattacc) { animator.SetFloat("Velocity", 0); canattacc = false; enemy.Animator.SetBool("Attack1", true); //attack code punch enemy.enemy_punch.enabled = true; punchendtimer = 0f; //move a lil forward, remove if not necessary enemy.transform.Translate(enemy.GetDirection() * Enemy1.MoveUnitsPerSecond * Time.deltaTime * 0.1f); } }