Exemplo n.º 1
0
    public void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
        }
        else
        {
            return;
        }

        Dialog.SetActive(false);
    }
Exemplo n.º 2
0
 void OnTriggerExit2D(Collider2D other)
 {
     POPUP.HideMessage();
 }
Exemplo n.º 3
0
    void OnTriggerEnter2D(Collider2D other)
    {
        //if (other.gameObject.tag == "Die") {
        //	transform.position = LastCheckPoint().position;
        //	gameObject.GetComponent<HPController>().takeDamage(100); // раскоментить

        //}



        if (other.tag == "CheckPoint")
        {
            other.GetComponent <CheckPointController>().active = true;
            other.GetComponent <BoxCollider2D>().enabled       = false;
        }


        if (other.tag == "Bird")
        {
            CountBird++;             //
            Destroy(other.gameObject);
        }

        if (other.tag == "Photo")
        {
            CountPhotos++;
            Destroy(other.gameObject);
        }

        if (other.tag == "EndOfLevel")
        {
            if (LevelIndex == 4)
            {
                if (CountBird >= 7)
                {
                    SceneManager.LoadScene(LevelIndex);
                }
                else
                {
                    POPUP.ShowMessage("You have not collected all the chicks !!!");
                }
            }
            if (LevelIndex == 6)
            {
                if (CountPhotos >= 10)
                {
                    SceneManager.LoadScene(LevelIndex);
                }
                else
                {
                    POPUP.ShowMessage("You have not collected all the pieces of the photo !!!");
                }
            }
        }



        if (other.tag == "Owl")
        {
            if (goDi)
            {
                gameObject.GetComponent <HPController>().takeDamage(10);
                goDi = false;
                StartCoroutine(Wait());
            }
        }
    }