using UnityEngine;
using System.Collections;

public class Kamikaze : MonoBehaviour {

    public GameObject boom;
    
    

    // Use this for initialization
    void Start () {
        boom.SetActive(false);
    }
	
	// Update is called once per frame
	void Update () {
	
	}



    void OnTriggerEnter(Collider collision)
    {

        MoveSubmarine submarinePlayer = collision.gameObject.GetComponent<MoveSubmarine>();

        if (submarinePlayer != null)
        {
            // For all others : kill!


            //HealthSubmarine.HealthPoints -= 100;

            // Destruct myself
            //Destroy(gameObject);
            HealthSubmarine.mtouched = true;
            StartCoroutine("explosionK");

        }
    }

    public IEnumerator explosionK()
    {

        boom.SetActive(true);
        
       
        yield return new WaitForSeconds(1.0f);
        
        Destroy(gameObject);
       
    }
}
