Friday, November 06, 2015

Scripts

DestroyByContact Script

using UnityEngine;
using System.Collections;

public class DestroyByContact : MonoBehaviour 
{
    public GameObject explosion;
    public GameObject playerExplosion;

    void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Boundary")
        
        {
            return;
        }
        Instantiate (explosiontransform.positiontransform.rotation);
        if (other.tag == "Player") {
            Instantiate (playerExplosionother.transform.positionother.transform.rotation);
        }
        Destroy (other.gameObject);
        Destroy (gameObject);
    }
}

DestroyByBoundary

using UnityEngine;
using System.Collections;

public class DestroyByBoundary : MonoBehaviour 
{
    void OnTriggerExit (Collider other
    {
        Destroy(other.gameObject);
    }
}

No comments: