Skip to content
Permalink
fc0ac69668
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
26 lines (23 sloc) 517 Bytes
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class HealthScript : MonoBehaviour
{
public static int healthValue = 100;
Text health;
void Start()
{
health = GetComponent<Text>();
}
// Update is called once per frame
void Update()
{
health.text = "Health:" + healthValue;
if (healthValue <= 1)
{
Time.timeScale = 0;
health.text = "Game Over";
}
}
}