Created
November 14, 2021 15:28
-
-
Save didacus/196dee2ef0de6af9934dc2e4d9a216f1 to your computer and use it in GitHub Desktop.
Unity - Basic player damage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class DamagePlayer : MonoBehaviour | |
{ | |
public int damageToGive; | |
public void OnTriggerEnter(Collider other) | |
{ | |
if (other.gameObject.tag == "Player") | |
{ | |
other.gameObject.GetComponent<PlayerHealthManager>().DamagePlayer(damageToGive); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment