private void OnCollisionEnter2D(Collision2D collision) { if (collision.gameObject.CompareTag("Player")) { Debug.Log("Verso della balena"); player = collision.gameObject.GetComponent <PlayerControllerLinear>(); player.ObstaclesAudio.clip = audioClip; player.ObstaclesAudio.Play(); } }
private void Awake() { playerController = FindObjectOfType <PlayerControllerLinear>(); audioSource = GetComponent <AudioSource>(); }