// Update is called once per frame void Update() { if (gunPosition != null) { transform.position = gunPosition.position; } FollowMouse(); if (Input.GetMouseButtonDown(0) && animator != null && attackType != null) { if (timeBtwAttacks <= 0) { if (Input.GetMouseButtonDown(0)) { //animator.SetTrigger("Attack"); attackType.attack(attackRange, damage, whatIsEnnemy); } timeBtwAttacks = startTimeBtwAttacks; } else { timeBtwAttacks -= Time.deltaTime; } } }