void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "Finish") { gameManager.SwitchState(State.SCOREBOARD); gameManager.glfm.UpdateLevel(); gameManager.AddToScore(); gameManager.EnemyDefeatedRefresh(); } if (other.gameObject.tag == "Coin") { gameManager.AddCurrentScore(1); source.PlayOneShot(coinSound); Destroy(other.gameObject); } if (other.gameObject.tag == "Item") { Daiktas daiktas = other.gameObject.GetComponent <SaugojimasDaiktoInformacijos>().NuDuokInformacija(); GameObject inventorius = GameObject.Find("Daiktai"); inventorius.GetComponent <Inventorius>().Prideti(daiktas); source.PlayOneShot(coinSound); Destroy(other.gameObject); } }