Labo_2_equ_2_a15/Assets/CollisionCheck.cs
JoelLapointe86 77de950b72 Pick ups 50% fonctionnel
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
2015-11-25 00:55:53 -05:00

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);
}
}
}