using System.Collections; using System.Collections.Generic; using UnityEngine; public class Projectile : MonoBehaviour { [SerializeField] private float damage; private bool haveBeenReflected = false; public void Init(float speed) { GetComponent().velocity = transform.up * speed; } private void OnCollisionEnter2D(Collision2D collision) { // Hvad fuck er det her kode �rligt. hj�lp { if (haveBeenReflected && collision.gameObject.CompareTag("Enemy")) { HealthComponent enemyHealth = collision.gameObject.GetComponent(); enemyHealth.TakeDamage(damage); Destroy(gameObject); } else if (collision.gameObject.CompareTag("Player")) { HealthComponent playerHealth = collision.gameObject.GetComponent(); playerHealth.TakeDamage(damage); Destroy(gameObject); } } } }