//private void OnTriggerEnter(Collider other)
    //{
    //    // Collect all the colliders in a sphere from the shell's current position to a radius of the explosion radius.
    //    Collider[] colliders = Physics.OverlapSphere(transform.position, m_ExplosionRadius, m_TankMask);

    //    // Go through all the colliders...
    //    for (int i = 0; i < colliders.Length; i++)
    //    {
    //        Rigidbody targetRigidbody = colliders[i].GetComponent<Rigidbody>();


    //        //targetRigidbody.AddExplosionForce(m_ExplosionForce, transform.position, m_ExplosionRadius);


    //        if (!targetRigidbody)
    //            continue;

    //        SubMovment targetHealth = targetRigidbody.GetComponent<SubMovment>();

    //        if (!targetHealth)
    //            continue;

    //        //SubStun.Stunned = true;


    //        Debug.Log("I hit");
    //    }

    //    //Unparent the particles from the shell.
    //      m_ExplosionParticles.transform.parent = null;

    //    //Play the particle system.
    //     m_ExplosionParticles.Play();

    //    //Play the explosion sound effect.
    //     m_ExplosionAudio.Play();

    //    //Once the particles have finished, destroy the gameobject they are on.
    //     ParticleSystem.MainModule mainModule = m_ExplosionParticles.main;
    //    Destroy(m_ExplosionParticles.gameObject, mainModule.duration);

    //    // Destroy the shell.
    //    Destroy(gameObject);
    //}


    private void OnTriggerEnter(Collider other)
    {
        Collider[] colliders = Physics.OverlapSphere(transform.position, m_ExplosionRadius, m_TankMask);
        for (int i = 0; i < colliders.Length; i++)
        {
            Rigidbody targetRidgidbody = colliders[i].GetComponent <Rigidbody>();

            if (!targetRidgidbody)
            {
                continue;
            }

            //targetRidgidbody.AddExplosionForce(m_ExplosionForce, transform.position, m_ExplosionRadius);

            SubMovment targetHealth = targetRidgidbody.GetComponent <SubMovment>();

            if (!targetHealth)
            {
                continue;
            }


            targetHealth.Hit();

            //Unparent the particles from the shell.
            m_ExplosionParticles.transform.parent = null;

            //Play the particle system.
            m_ExplosionParticles.Play();

            //Play the explosion sound effect.
            m_ExplosionAudio.Play();

            //Once the particles have finished, destroy the gameobject they are on.
            ParticleSystem.MainModule mainModule = m_ExplosionParticles.main;
            Destroy(m_ExplosionParticles.gameObject, mainModule.duration);

            Destroy(gameObject);
        }
    }
        private GameObject m_CanvasGameObject;      // Used to disable the world space UI during the Starting and Ending phases of each round.



        public void Setup()
        {
            // Get references to the components.
            m_Movement         = m_Instance.GetComponent <SubMovment>();
            m_Shooting         = m_Instance.GetComponent <TankShooting>();
            m_CanvasGameObject = m_Instance.GetComponentInChildren <Canvas>().gameObject;

            // Set the player numbers to be consistent across the scripts.
            //m_Movement.PlayerNumber = m_PlayerNumber;
            m_Shooting.m_PlayerNumber = m_PlayerNumber;

            // Create a string using the correct color that says 'PLAYER 1' etc based on the tank's color and the player's number.
            m_ColoredPlayerText = "<color=#" + ColorUtility.ToHtmlStringRGB(m_PlayerColor) + ">PLAYER " + m_PlayerNumber + "</color>";

            // Get all of the renderers of the tank.
            MeshRenderer[] renderers = m_Instance.GetComponentsInChildren <MeshRenderer>();

            // Go through all the renderers...
            for (int i = 0; i < renderers.Length; i++)
            {
                // ... set their material color to the color specific to this tank.
                renderers[i].material.color = m_PlayerColor;
            }
        }