mirror of
https://github.com/ConjureETS/Labo_2_equ_2_a15.git
synced 2026-03-24 01:21:07 +00:00
on peut prendre une bombe et la lancer mais elle ne tue pas l'ennemi la caisse de vie peut être prise mais ne soigne pas
27 lines
441 B
C#
27 lines
441 B
C#
using UnityEngine;
|
|
using System.Collections;
|
|
using UnityEngine.UI;
|
|
|
|
public class CollisionCheck : MonoBehaviour {
|
|
|
|
public Text health;
|
|
|
|
|
|
public void initText(int hp)
|
|
{
|
|
health.text = "Health: " + hp;
|
|
}
|
|
|
|
void OnCollisionEnter2D(Collision2D col)
|
|
{
|
|
if(col.gameObject.name == "Enemy")
|
|
{
|
|
health.text = "Health: " + gameObject.GetComponent<Health>().removeHP(1);
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|