unity-atoms/Assets/UnityAtoms/Examples/Intro/Scripts/Harmful.cs
2018-11-12 22:19:12 +01:00

17 lines
361 B
C#

using UnityEngine;
using UnityEngine.UI;
using UnityAtoms;
namespace UnityAtoms.Examples
{
public class Harmful : MonoBehaviour
{
void OnTriggerEnter2D(Collider2D collider)
{
if (collider.tag == "Player")
{
collider.GetComponent<PlayerHealth>().Health.Value -= 10;
}
}
}
}