public void Fire() { // Create an instance of the shell and store a reference to it's rigidbody. Rigidbody shellInstance = Instantiate(m_Shell, m_FireTransform.position, m_FireTransform.rotation) as Rigidbody; ShellExplosion exp = shellInstance.GetComponent <ShellExplosion>(); exp.Initialize(m_ShellGravity, m_MaxShellBounces, m_ProjectileSpeed * m_FireTransform.forward); // Set the shell's velocity to the launch force in the fire position's forward direction. //shellInstance.velocity = m_ProjectileSpeed * m_FireTransform.forward; // Change the clip to the firing clip and play it. m_ShootingAudio.clip = m_FireClip; m_ShootingAudio.Play(); }
private void Fire() { // Create an instance of the shell and store a reference to it's rigidbody. ShellExplosion shellInstance = Instantiate(m_Shell, m_FireTransform.position, m_FireTransform.rotation).GetComponent <ShellExplosion>(); shellInstance.Initialize(false, 1, m_ProjectileSpeed * m_FireTransform.forward); m_ShootingMuzzle.gameObject.SetActive(true); m_ShootingSmoke.gameObject.SetActive(true); // Change the clip to the firing clip and play it. m_ShootingAudio.clip = m_FireClip; m_ShootingAudio.Play(); }