Chataigne/Assets/Script/Damager.cs
Djalim Simaila 70ea99a9ce CHANGEMENTS
SlowDown
Respawn & Checkpoint
Barre de vie (bug ; vie ne -2)
+ ajouts d'assets
2023-05-07 19:46:55 +02:00

22 lines
483 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Damager : MonoBehaviour
{
[SerializeField] public int damageValue;
private void OnTriggerEnter2D(Collider2D collision)
{
if(collision.gameObject.CompareTag("Joueur"))
{
Player player = collision.gameObject.GetComponent<Player>();
Debug.Log(player.health);
player.hurt(damageValue);
}
}
}