Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma strict
- var Health = 100;
- var player : GameObject;
- var healthgreen : GameObject;
- var healthyellow : GameObject;
- function ApplyDammage (TheDammage : int)
- {
- Health -= TheDammage;
- if(Health <= 0)
- {
- Dead();
- }
- {
- if(Health <= 80)
- {
- healthgreen.SetActive(true);
- }
- }
- {
- if(Health <= 20)
- {
- healthyellow.SetActive(true);
- }
- }
- }
- function Dead (){
- player.animation.Play();
- yield WaitForSeconds(1.5);
- player.animation.Stop();
- yield WaitForSeconds(4);
- Application.LoadLevel("test");
- }
Advertisement
Add Comment
Please, Sign In to add comment