private void OnTriggerEnter2D(Collider2D collision) { //Check if shark collided with fish if (collision.tag == "Fish") { NPC_Fish fishRef = collision.GetComponent <NPC_Fish>(); //Add point if correct fish was eaten if (fishRef.GetFishType() == _fish_desired) { _scoreboard.AddScore(); ChangeDesiredFish(); } else//Otherwise end the game { _gameOver = true; transform.localScale = Vector3.one; foreach (GameObject g in _bubbles) { g.SetActive(false); } _scoreboard.DisplayEndScreen(); _col_self.enabled = false; } //Remove the fish fishRef.ClearFish(); } }
private void Awake() { NPC_Fish.LoadFish(); }