void Fire() { playSingleleSound(shootSnd); MuzzleFlash.Play(); clipAmmo--; RaycastHit hit; if (Physics.Raycast(fpsCam.transform.position, fpsCam.transform.forward, out hit, range)) { Debug.Log(hit.transform.name); Enemy enemy = hit.transform.GetComponent <Enemy>(); GoblinEnemy GoblinEnemy = hit.transform.GetComponent <GoblinEnemy>(); BompEnemy BompEnemy = hit.transform.GetComponent <BompEnemy>(); BossEnemy BossEnemy = hit.transform.GetComponent <BossEnemy>(); if (GameManager.player == true) { Character1 Player2 = hit.transform.GetComponent <Character1>(); if (Player2 != null) { Player2.TakeDamage(Damage); } } if (BossEnemy != null) { BossEnemy.TakeDamage(Damage); } if (BompEnemy != null) { BompEnemy.TakeDamage(Damage); } if (GoblinEnemy != null) { GoblinEnemy.TakeDamage(Damage); } if (enemy != null) { enemy.TakeDamage(Damage); } GameObject ImplactGameObejct = Instantiate(ImplactEfect, hit.point, Quaternion.LookRotation(hit.normal)); Destroy(ImplactGameObejct, 0.5f); } anim.SetTrigger("Shoot"); }