示例#1
0
        void FatherSelected(string father)
        {
            if (father.Equals("Yellow"))
            {
                StatKeeper.setStats(10, 4, 7, 5, 4);

                StatKeeper.SelectFather("Charisma");

                int temp = SceneManager.GetActiveScene().buildIndex;

                SceneManager.LoadScene(temp + 1);
            }
            else if (father.Equals("Blue"))
            {
                StatKeeper.setStats(10, 4, 4, 5, 7);

                StatKeeper.SelectFather("Luck");

                int temp = SceneManager.GetActiveScene().buildIndex;

                SceneManager.LoadScene(temp + 1);
            }
            else if (father.Equals("Bloody"))
            {
                StatKeeper.setStats(10, 7, 4, 5, 4);

                StatKeeper.SelectFather("Strength");

                int temp = SceneManager.GetActiveScene().buildIndex;

                SceneManager.LoadScene(temp + 1);
            }
        }
        void Awake()
        {
            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());

                YellowKnightToggle.SetActive(false);
                BlueKnightToggle.SetActive(false);
                BloodyKnightToggle.SetActive(false);

                toggleFathers();
            }
        }