Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class life : MonoBehaviour {
- public float PlayerLife = 100;
- public bool Dead = false;
- public int DecreaseLife;
- // Use this for initialization
- void Start () {
- }
- // Update is called once per frame
- void Update () {
- if (PlayerLife == 0) {
- Dead = true;
- }
- if (Dead == true) {
- Application.LoadLevel (0);
- }
- }
- void OnCollisionEnter(Collision col)
- {
- if (col.gameObject.tag == "Énemy") {
- DecreaseLife;
- }
- if (DecreaseLife)
- PlayerLife = PlayerLife - 50;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement