void OnTriggerEnter2D(Collider2D colli)
        {
            if (colli.CompareTag("Doggo"))
            {
                SoundManager.instance.musicSource.PlayOneShot(doggo, 1.0f);

                dialog.text = DialogScript.getDialog(int.Parse(colli.gameObject.name));

                StatKeeper.DoggoDiscovered(int.Parse(colli.gameObject.name));
            }

            if (colli.CompareTag("NPC"))
            {
                dialog.text = DialogScript.getDialog(int.Parse(colli.gameObject.name));
            }
            else if (colli.CompareTag("HostileNPC") == true)
            {
                StatKeeper.receiveDamage(2);
            }
            else if (colli.CompareTag("YellowKnight") == true)
            {
                if (YellowKnightToggle.activeSelf == false)
                {
                    SoundManager.instance.musicSource.PlayOneShot(yellowKnight, 1.0f);

                    toggleFathers();

                    YellowKnightToggle.SetActive(true);
                }
            }
            else if (colli.CompareTag("BlueKnight") == true)
            {
                if (BlueKnightToggle.activeSelf == false)
                {
                    SoundManager.instance.musicSource.PlayOneShot(blueKnight, 1.0f);

                    toggleFathers();

                    BlueKnightToggle.SetActive(true);
                }
            }
            else if (colli.CompareTag("BloodyKnight") == true)
            {
                if (BloodyKnightToggle.activeSelf == false)
                {
                    SoundManager.instance.musicSource.PlayOneShot(bloodyKnight, 1.0f);

                    toggleFathers();

                    BloodyKnightToggle.SetActive(true);
                }
            }
            else
            {
                toggleFathers();

                dialog.text = DialogScript.getNullDialog();
            }
        }
예제 #2
0
        void OnTriggerEnter2D(Collider2D colli)
        {
            if (colli.CompareTag("NPC"))
            {
                dialog.text = DialogScript.getDialog(int.Parse(colli.gameObject.name));

                /*}else if (colli.CompareTag("Wench")) {
                 * dialog.text = DialogScript.getDialog(int.Parse(colli.gameObject.name));
                 */
            }
            else if (colli.CompareTag("HiddenHoboCoin") == true)
            {
                Debug.Log("Oh look, a HoboCoin !");

                StatKeeper.collectHoboCoin();
            }
            else if (colli.CompareTag("HostileNPC") == true)
            {
                StatKeeper.receiveDamage(2);
            }
            else if (colli.CompareTag("YellowKnight") == true)
            {
                if (YellowKnightToggle.activeSelf == false)
                {
                    YellowKnightToggle.SetActive(true);
                }
            }
            else if (colli.CompareTag("BlueKnight") == true)
            {
                if (BlueKnightToggle.activeSelf == false)
                {
                    BlueKnightToggle.SetActive(true);
                }
            }
            else if (colli.CompareTag("BloodyKnight") == true)
            {
                if (BloodyKnightToggle.activeSelf == false)
                {
                    BloodyKnightToggle.SetActive(true);
                }
            }
            else
            {
                dialog.text = DialogScript.getNullDialog();
            }
        }
예제 #3
0
        void Awake()
        {
            DialogScript.DialogInit();

            dialog = GameObject.Find("ShowDialog/DialogBox").GetComponent <Text>();


            if (SceneManager.GetActiveScene().name.Equals("Childhood room 1"))
            {
                StatKeeper.setStats(5, 0, 0, 0, 0);

                //Finds the objects and assings the correct methods if you click the buttons
                YellowKnightToggle = GameObject.Find("YellowKnightToggle");
                YellowYes          = GameObject.Find("YellowKnightToggle/YesButton").GetComponent <Button> ();
                YellowNo           = GameObject.Find("YellowKnightToggle/NoButton").GetComponent <Button> ();

                BlueKnightToggle = GameObject.Find("BlueKnightToggle");
                BlueYes          = GameObject.Find("BlueKnightToggle/YesButton").GetComponent <Button> ();
                BlueNo           = GameObject.Find("BlueKnightToggle/NoButton").GetComponent <Button> ();

                BloodyKnightToggle = GameObject.Find("BloodyKnightToggle");
                BloodyYes          = GameObject.Find("BloodyKnightToggle/YesButton").GetComponent <Button> ();
                BloodyNo           = GameObject.Find("BloodyKnightToggle/NoButton").GetComponent <Button> ();

                YellowYes.onClick.AddListener(() => FatherSelected("Yellow"));
                YellowNo.onClick.AddListener(() => resumeGame());

                BlueYes.onClick.AddListener(() => FatherSelected("Blue"));
                BlueNo.onClick.AddListener(() => resumeGame());

                BloodyYes.onClick.AddListener(() => FatherSelected("Bloody"));
                BloodyNo.onClick.AddListener(() => resumeGame());

                toggleFathers();
            }
        }