public void GameOver() { GameObject g2 = Instantiate(particles); var main = g2.GetComponent <ParticleSystem>(); main.startColor = Color.black; g2.transform.position = player.transform.position; Destroy(player.gameObject); GameoverPannel.SetActive(true); gameOver = true; }
// Start is called before the first frame update void Start() { die = Resources.Load <AudioClip>("music/die"); powerup = Resources.Load <AudioClip>("music/power_up"); jump = Resources.Load <AudioClip>("music/jump"); win = Resources.Load <AudioClip>("music/win"); //PlayerPrefs.SetInt("justCurrentLevel", -1); PauseButton.SetActive(false); Physics2D.gravity = new Vector2(0, 0); Application.targetFrameRate = 60; player = GameObject.FindGameObjectWithTag("Player"); GameoverPannel.SetActive(false); PauseMenu.SetActive(false); WonMenu.SetActive(false); Time.timeScale = 1; playerSprite = player.GetComponent <SpriteRenderer>(); playerSpriteColor = playerSprite.color; playerSpriteColor.a = 0; playerSprite.color = playerSpriteColor; scaleWater = water.transform.localScale; //Audio = FindObjectOfType<AudioSource>(); }