public void OnTriggerEnter2D(Collider2D collision) { #region /* * implementação lógica de perda e ganhos */ if (collision.gameObject.tag == "Obstacle") { if (lives > 0) { if (!superPower) { Destroy(GameObject.Find("Life" + lives.ToString())); lives -= 1; } } else { if (score > bestScore) { bestScore = score; PlayerPrefs.SetInt("BestScore", bestScore); } PlayGamesController.AddScoreToRanking(GPGSIds.leaderboard_ranking, (long)score); PlayerPrefs.SetInt("CltdIdeias", cltdIdeias); PlayerPrefs.SetInt("CltdLux", cltdLuxes); PlayerPrefs.SetInt("MindsReleased", mindsReleased); gpgCtrl.GameOver(); } } else if (collision.gameObject.tag == "Ideia") { score += 1000; cltdIdeias += 1; StartCoroutine("ExplodeSynapse", collision.gameObject.transform); Destroy(collision.gameObject); } else if (collision.gameObject.tag == "Lux") { score += 10000; cltdLuxes += 1; //Jogador recebe um Mind if (cltdLuxes == freeMindInterval) { mindsReleased += 1; freeMindInterval = cltdLuxes + 10; //Debug.Log("Muito bem! Você libertou uma mente!"); } StartCoroutine("ExplodeLux", collision.gameObject.transform); Destroy(collision.gameObject); } #endregion }