void OnTriggerEnter2D(Collider2D collider) { livesScript = FindObjectOfType<Lives>(); Destroy (collider.gameObject); livesScript.LoseLives(); }
void OnCollisionEnter2D(Collision2D col) { levelManager = GameObject.FindObjectOfType <LevelManager>(); if (col.gameObject.name == "ballfish") { ball.hasStarted = false; lives--; life.LoseLives(lives); Instantiate(Resources.Load("explosion"), ball.transform.position, Quaternion.identity); if (lives <= -1) { Invoke("Loser", 2f); Destroy(ball.gameObject); } } }