

Private float CalculateDamage (Vector3 targetPosition) M_ = null ĭestroy (m_ExplosionParticles.gameObject, m_) TankHealth targetHealth = targetRigidbody.GetComponent () įloat damage = CalculateDamage (targetRigidbody.position)

TargetRigidbody.AddExplosionForce (m_ExplosionForce, transform.position, m_ExplosionRadius) Private void OnTriggerEnter (Collider other)Ĭollider colliders = Physics.OverlapSphere(transform.position, m_ExplosionRadius, m_TankMask) If it isn't destroyed by then, destroy the shell after it's lifetime. Public float m_ExplosionRadius = 5f // The maximum distance away from the explosion tanks can be and are still affected. Public float m_MaxLifeTime = 2f // The time in seconds before the shell is removed.

Public float m_ExplosionForce = 1000f // The amount of force added to a tank at the centre of the explosion. Public float m_MaxDamage = 100f // The amount of damage done if the explosion is centred on a tank. Public AudioSource m_ExplosionAudio // Reference to the audio that will play on explosion. Public ParticleSystem m_ExplosionParticles // Reference to the particles that will play on explosion. Public LayerMask m_TankMask // Used to filter what the explosion affects, this should be set to "Players". Public class ShellExplosion : MonoBehaviour i tried accessing health by buttons but it works but shell damage not working the only code i change apart from tutorial is. I followed tutorial but when but the shell does not give damage to player health.
