Advertisement
Guest User

Untitled

a guest
May 23rd, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.69 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class life : MonoBehaviour {
  5.     public float PlayerLife = 100;
  6.     public bool Dead = false;
  7.     public int DecreaseLife;
  8.     // Use this for initialization
  9.     void Start () {
  10.  
  11.     }
  12.  
  13.     // Update is called once per frame
  14.     void Update () {
  15.         if (PlayerLife == 0) {
  16.             Dead = true;
  17.  
  18.         }
  19.         if (Dead == true) {
  20.             Application.LoadLevel (0);
  21.      
  22.         }
  23.     }
  24.     void OnCollisionEnter(Collision col)
  25.     {
  26.         if (col.gameObject.tag == "Énemy") {
  27.             DecreaseLife;
  28.      
  29.         }
  30.         if (DecreaseLife)
  31.             PlayerLife = PlayerLife - 50;
  32.  
  33.     }
  34.  
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement