using System.Collections;

using System.Collections.Generic;

using UnityEngine;


public class BulletEnemy : MonoBehaviour

{

    float Speed = 10f;

    public GameObject explosionFactory;

    // Start is called before the first frame update

    void Start()

    {

        

    }


    // Update is called once per frame

    void Update()

    {

        Vector3 dir = Vector3.down;

        transform.position += dir * Speed * Time.deltaTime;

    }

    private void OnCollisionEnter(Collision collision)

    {

        Destroy(collision.gameObject);

        Destroy(this.gameObject);

        GameObject explosion = Instantiate(explosionFactory);

        explosion.transform.position = transform.position;

    }

}

적이 날 쏘면 맞아야되는데 아예 안맞고 겹쳐져서 지나가버림