// Start is called before the first frame update void Start() { score = FindObjectOfType <background>(); StartCoroutine(new_wave()); score.start_score(); score.reset_score(); Instantiate(Resources.Load("player", typeof(GameObject)), new Vector3(0, -3.5f, 0), Quaternion.identity); }
void health_check() { if (this.tag == "Player") { healthbar.text = "Health:" + life; } if (life <= 0) { GameObject dead = (GameObject)Instantiate(Resources.Load("dead", typeof(GameObject)), transform.position, Quaternion.identity); Destroy(dead, 1f); if (this.tag == "Player") { button.lose_game(); score.reset_score(); } else { score.increase_score(); } Destroy(this.gameObject); } }