Bomb.cs 638 B

123456789101112131415161718192021222324252627
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class Bomb : MonoBehaviour {
  5. public int damage;
  6. public GameObject boom;
  7. public float boomtime;
  8. // Use this for initialization
  9. void Start () {
  10. StartCoroutine(CreateBoom());
  11. }
  12. IEnumerator CreateBoom()
  13. {
  14. yield return new WaitForSeconds(boomtime);
  15. GameObject boomEF = Instantiate(boom, transform.position, boom.transform.rotation) as GameObject;
  16. boomEF.GetComponent<Boom>().damage = damage;
  17. Destroy(this.gameObject);
  18. }
  19. // Update is called once per frame
  20. void Update () {
  21. }
  22. }