ObstacleDestoyer.cs 357 B

12345678910111213141516171819
  1. using System;
  2. using UnityEngine;
  3. using System.Collections;
  4. public class ObstacleDestoyer : MonoBehaviour {
  5. public GameObject Particle;
  6. public float DeltaY= 1;
  7. public void BlowUp()
  8. {
  9. if(Particle)
  10. {
  11. var go = Instantiate(Particle,transform.position + Vector3.up * DeltaY,transform.rotation);
  12. Destroy(go,5);
  13. }
  14. Destroy (gameObject);
  15. }
  16. }