コード例 #1
0
    //
    void Shoot()
    {
        //Stores information what got hit with the ray
        RaycastHit hit;


        if (Physics.Raycast(shootFrom.transform.position, shootFrom.transform.forward, out hit, range) && currentlyReloading == false)
        {
            Hit target = hit.transform.GetComponent <Hit>();
            if (target != null)
            {
                if (target.CompareTag("Enemy"))
                {
                    enemyAudio.PlayOneShot(camelDeath, 0.2f);
                    target.Death(damage);
                }
            }
        }
    }