Example #1
0
    void Shoot()
    {
        m_cameraController.ApplyScreenShake(0.15f, 0.03f);
        m_shotPart.Play();
        m_sparkPart.Play();
        m_anim.Stop();
        m_anim.Play();
        m_source.PlayOneShot(m_source.clip);
        Transform bullet = Instantiate(m_bulletPrefab, m_firePoint.position, m_firePoint.rotation);

        bullet.GetComponent <Bullet>().Initialize(transform.forward);

        RaycastHit hit;

        if (Physics.Raycast(m_firePoint.position, m_firePoint.forward, out hit, m_range, m_gunHitLayers))
        {
            GameObject go = Instantiate(impactParticle, hit.point, Quaternion.LookRotation(hit.normal));
            Destroy(go, 1.0f);

            GunTarget gt = hit.transform.GetComponent <GunTarget>();
            if (gt != null)
            {
                gt.TakeHit(m_damage);
            }
        }
    }
Example #2
0
 private void OnTriggerEnter(Collider other)
 {
     other.GetComponentInParent <Rabboid>().GettingShredded(m_shredTargetPos.position);
     m_cameraController.ApplyScreenShake(2.7f, 0.02f);
 }