void OnTriggerEnter2D(Collider2D other)
 {
     if (other.CompareTag("Player"))
     {
         gameManager.LevelComplete();
         Destroy(other.gameObject);
     }
 }
Beispiel #2
0
    public IEnumerator RunTalk(bool initial)
    {
        GameObject previous     = null;
        var        conversation = initial ? initialTalk : endTalk;

        gameManager.EnablePlayer(false);

        if (!PlayerPrefManager.IsTalked())
        {
            foreach (GameObject talk in conversation)
            {
                if (previous != null)
                {
                    previous.SetActive(false);
                }

                talk.SetActive(true);
                audioSource.PlayOneShot(talkSFX);
                previous = talk;

                yield return(new WaitForSeconds(7f));
            }

            previous.SetActive(false);

            PlayerPrefManager.SetAlreadyTalkedFlag();
        }

        if (initial)
        {
            StartFinalBattle();
        }
        else
        {
            gameManager.LevelComplete();
        }
    }