public void die() { if (!alreadyDead) { alreadyDead = true; gameObject.GetComponent <PlayerMovement>().enabled = false; gameObject.GetComponent <Animator>().SetBool("IsDead", true); GameStores.BreadQuantity -= GameStores.levelBread; GameStores.changeScene(); gameObject.GetComponent <AudioSource>().Play(); gameObject.GetComponent <Rigidbody2D>().velocity = new Vector3(0, gameObject.GetComponent <Rigidbody2D>().velocity.y, 0); StartCoroutine(respawn2()); } }
// Start is called before the first frame update void Start() { GameStores.changeScene(); for (int x = 0; x < canvas.Length; x++) { if (x == n) { canvas[x].enabled = true; } else { canvas[x].enabled = false; } } }
public void Start() { GameStores.changeScene(); }