using System.Collections; using System.Collections.Generic; using UnityEngine; /* -------------------------------------- Project: Programing assessment Standard: 91906 (AS3.7) v.1 School: Tauranga Boys' College Author: Rauputu Noah Phizacklea Date: August 2024 Unity: 2021.3.18f --------------------------------------- */ public class EnemyDamage : MonoBehaviour { public int damage; // Damage dealt by the enemy public PlayerHealth playerHealth; // Reference to the PlayerHealth component void OnCollisionEnter2D(Collision2D collision) { // Check if the collided object has the "Player" tag if (collision.gameObject.tag == "Player") { // Apply damage to the player playerHealth.TakeDamage(damage); } } }