1
Fork 0
mirror of https://github.com/Steffo99/beat-td.git synced 2024-11-22 23:34:19 +00:00
beat-td/Assets/Scripts/GameStatus.cs

34 lines
752 B
C#
Raw Normal View History

2018-04-22 12:07:55 +00:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class GameStatus : MonoBehaviour {
public int money = 0;
public int lives = 10;
public GameObject moneyTextObject;
private Text moneyText;
public GameObject livesTextObject;
private Text livesText;
void Start()
{
moneyText = moneyTextObject.GetComponent<Text>();
livesText = livesTextObject.GetComponent<Text>();
}
void Update()
{
moneyText.text = money.ToString();
livesText.text = lives.ToString();
}
public void EnemyFinishedPath(GameObject enemy)
{
lives -= enemy.GetComponent<EnemyStatus>().livesCost;
Destroy(enemy);
}
}