31 lines
550 B
C#
31 lines
550 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class Projectile : MonoBehaviour
|
|
{
|
|
|
|
private Vector2 vel;
|
|
private Rigidbody2D rb;
|
|
private BoxCollider2D bc;
|
|
|
|
void Start()
|
|
{
|
|
rb = GetComponent<Rigidbody2D>();
|
|
bc = GetComponent<BoxCollider2D>();
|
|
vel = rb.velocity;
|
|
GetComponent<Collider2D>().enabled = false;
|
|
}
|
|
|
|
void FixedUpdate()
|
|
{
|
|
rb.velocity = vel;
|
|
}
|
|
|
|
|
|
void OnTriggerEnter2D(Collider2D bc)
|
|
{
|
|
Destroy(gameObject);
|
|
}
|
|
}
|