void Shoot() { if (timeBtwShots > 0) { return; } RaycastHit2D info = Physics2D.Raycast(muzzle.position, transform.right, Distance, shootWut); GameObject obj = Instantiate(projectile, muzzle.position, Quaternion.identity); Bullet bullet = obj.GetComponent <Bullet>(); CS.Shake(); if (offset == 0) { bullet.offset = -90f; } else { bullet.offset = 90f; } audioSource.Play(); if (info.collider != null) { if (!info.collider.CompareTag("Environment")) { Enemy enemy = info.collider.GetComponent <Enemy>(); if (enemy != null) { Vector3 popUp = info.collider.gameObject.transform.position; if (!isCritical) { enemy.TakeDamage(Damage); DamagePopUp.DamagePop(pfDamagePopup, "Hit", popUp); } if (isCritical) { enemy.TakeDamage(Critical); DamagePopUp.DamagePop(pfDamagePopup, "Critical", popUp); } } } } if (isCritical) { Fired = 0; TillCritical = Random.Range(4, 6); } if (RecoilIsActive) { playerController.KnockBack(10f, new Vector2(1f, 0f), RecoilForce); } Fired++; timeBtwShots = totalTimeBtwShots; }