Files
2026-06-30 21:21:30 +08:00

31 lines
819 B
C#

using UnityEngine;
namespace KD.Destro2D{
public class BasicMissile : MonoBehaviour
{
public GameObject DestructionObject;
public GameObject effect;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
Destroy(this.gameObject,4f);
}
// Update is called once per frame
void Update()
{
}
void OnCollisionEnter2D(Collision2D collision)
{
Vector2 hitPoint = collision.contacts[0].point;
if(this!= null){
Instantiate(DestructionObject,hitPoint,Quaternion.identity);
Instantiate(effect,hitPoint,Quaternion.identity);
Destroy(this.gameObject);
}
}
}
}