public class shootable : MonoBehaviour {
public Text countText;
private int count = 25;
void Start()
{
Debug.Log("Start" + count);
//count = 25;
setCountText();
}
void OnTriggerEnter2D(Collider2D other)
{
if (other.tag == "Shot")
{
Debug.Log("b4 " + count);
Destroy(other.gameObject);
Destroy(gameObject);
count--;
Debug.Log("after " + count);
setCountText();
}
if (count == 0)
{
Application.LoadLevel("Level2");
}
}
void setCountText()
{
countText.text = ("Enemies Remaining: " + count.ToString());
}
}