Exemplo n.º 1
0
    private void Fire(GameObject hitted, string tag)
    {
        if (!hitted.GetComponent <ZombieAI>().IsDead)
        {
            if (CrossHair.GetComponent <Animator>())
            {
                CrossHair.GetComponent <Animator>().Play("CrossHairAnimation");
            }
            muzzleFlashObject = Instantiate(muzzleFlash, spawnMuzzleFlashPos.position, spawnMuzzleFlashPos.rotation);
            hitted.GetComponent <ZombieAI>().TakeDamage((tag == ZOMBIE_TAG) ? Player.instance.Damage : Player.instance.HeadDamage);
            Instantiate(blood, hit.point, Quaternion.identity);
            soundsManager.FireSound();

            if (tag == HEAD_TAG)
            {
                Debug.Log("Head!");
            }
        }
    }