Пример #1
0
    void OnTriggerEnter2D(Collider2D otherCollider)
    {
        if (otherCollider.gameObject.name == "WinArea" && !hasWon)
        {
            Debug.Log("You win!");

            hasWon = true;

            // Stop background music and play the level completion sound effect instead
            soundEffectPlayer.StopBackgroundMusic();
            soundEffectPlayer.PlayWinEffect();

            // Don't spawn any more barrels
            if (barrelSpawner != null)
            {
                barrelSpawner.Stop();
            }
        }
    }