mirror of
https://github.com/kuhyx/praca_magisterska.git
synced 2026-11-27 23:09:09 +01:00
22 lines
424 B
C#
22 lines
424 B
C#
using UnityEngine;
|
|
|
|
public class Bullet : MonoBehaviour
|
|
{
|
|
public float speed = 10f;
|
|
|
|
void Update()
|
|
{
|
|
transform.Translate(Vector3.up * speed * Time.deltaTime);
|
|
if (transform.position.y > 10) Destroy(gameObject); // Out of bounds
|
|
}
|
|
|
|
void OnTriggerEnter2D(Collider2D other)
|
|
{
|
|
if (other.CompareTag("Enemy"))
|
|
{
|
|
Destroy(other.gameObject);
|
|
Destroy(gameObject);
|
|
}
|
|
}
|
|
}
|