using UnityEngine; public class Projectileboss : MonoBehaviour { public float lifetime = 5f; public float damage = 10f; // Damage yang diberikan ke player private Rigidbody2D rb; void Start() { Destroy(gameObject, lifetime); rb = GetComponent(); } void Update() { if (rb != null && rb.velocity != Vector2.zero) { float angle = Mathf.Atan2(rb.velocity.y, rb.velocity.x) * Mathf.Rad2Deg - 90f; transform.rotation = Quaternion.Euler(0f, 0f, angle); } } void OnTriggerEnter2D(Collider2D other) { if (other.CompareTag("Player")) { IDamageable player = other.GetComponent(); if (player != null) { player.TakeDamage(damage); } Destroy(gameObject); } } }