Beispiel #1
0
 bool CheckDia()
 {
     foreach (int i in DS.GetFin())
     {
         if (i == nowDiaID)
         {
             return(true);
         }
     }
     return(false);
 }
Beispiel #2
0
    // Update is called once per frame
    void Update()
    {
        SceneName = Application.loadedLevelName;

        if (Application.loadedLevelName == "Game_01" || Application.loadedLevelName == "Game_02" || Application.loadedLevelName == "Game_03")
        {
            User_Canvas.SetActive(true);
            Player   = GameObject.Find("Player");
            player_t = Player.transform;
            // Drama drama = gameObject.AddComponent<Drama>() as Drama;
            //Player.SetActive(true);

            if (!drama.enabled && Chapter == "Teaching")
            {
                drama.enabled = true;
            }

            if (!drama2.enabled && Chapter == "Chapter_0")
            {
                drama2.enabled = true;
            }

            /*
             * else
             * {
             * Scene2++;
             * }
             */
            if (isLoad)
            {
                /*
                 * GameObject g = GameObject.Find("Drama");
                 * Destroy(g);*/
                GameObject value = GameObject.Find("HP_Value");
                hp_script         = value.GetComponent("Calculation") as Calculation;
                hp_script.Hp      = PlayerPrefs.GetFloat("Player_HP");
                player_t.position = new Vector3(PlayerPrefs.GetFloat("Position_x"), PlayerPrefs.GetFloat("Position_y"), PlayerPrefs.GetFloat("Position_z"));
                if (PlayerPrefs.HasKey("Time"))
                {
                    Timer t = Timer.GetComponent("Timer") as Timer;
                    t.timer = PlayerPrefs.GetFloat("Time");
                }
                isLoad = false;
            }


            if (isReset)
            {
                GameObject u = GameObject.Find("User");
                u.BroadcastMessage("Reset", 0, SendMessageOptions.RequireReceiver);
                isReset = false;
            }
        }
        else if (Application.loadedLevelName == "Black")
        {
            PrintFinDiaTask(DS.GetFin(), TS.GetFin());
            Dia.SetActive(DS.isTalk);
        }
        else
        {
            tw.SetActive(false);
            t_ok.SetActive(false);
            User_Canvas.SetActive(false);
            if (Application.loadedLevelName != "Grave" && Application.loadedLevelName != "End1" && Application.loadedLevelName != "End2" && Application.loadedLevelName != "End3")
            {
                Dia.SetActive(false);
            }
        }

        if (Chapter != "Chapter_0")
        {
            Timer.SetActive(false);
            drama2.enabled = false;
            Icon_Task.SetActive(false);

            /*
             * if (Application.loadedLevelName == "Game_01")
             * {
             * CloseThing(Task_Btn);
             *
             * }*/
        }


        if (DS.isTalk && Player != null)
        {
            Control player_c = Player.GetComponent("Control") as Control;
            player_c.CanWalk = false;
        } // if
        else if (!DS.isTalk && Player != null)
        {
            Control player_c = Player.GetComponent("Control") as Control;
            player_c.CanWalk = true;
        }



        if (Chapter == "Chapter_0")
        {
            //TS.tm.xmlDoc = XDocument.Load(Application.dataPath + "/task2.xml");
            GameObject Father  = GameObject.Find("紀宇文");
            GameObject Father2 = GameObject.Find("紀宇文_2");
            Destroy(Father);
            Destroy(Father2);
            if (Application.loadedLevelName == "Game_02")
            {
                ChangePeople();
            }
            if (TS.GetNow().Count != 0)
            {
                Icon_Task.SetActive(true);
                if (!isCountdown)
                {
                    DS.Talking(13, 6, TS.GetFin());
                    Timer.SetActive(true);
                    isCountdown = true;
                }
            } // if

            if (TS.CheckSomeTask(7) || TS.CheckSomeTaskFin(7))
            {
                s1.SetActive(true);
            }
            else
            {
                s1.SetActive(false);
            }

            if (TS.CheckSomeTask(8) || TS.CheckSomeTaskFin(8))
            {
                s2.SetActive(true);
            }
            else
            {
                s2.SetActive(false);
            }

            if (TS.CheckSomeTask(9) || TS.CheckSomeTaskFin(9))
            {
                s3.SetActive(true);
            }
            else
            {
                s3.SetActive(false);
            }

            if (TS.CheckSomeTask(10) || TS.CheckSomeTaskFin(10))
            {
                s4.SetActive(true);
            }
            else
            {
                s4.SetActive(false);
            }

            if (TS.CheckSomeTask(11) || TS.CheckSomeTaskFin(11))
            {
                s5.SetActive(true);
            }
            else
            {
                s5.SetActive(false);
            }

            if (TS.CheckSomeTask(12) || TS.CheckSomeTaskFin(12))
            {
                s6.SetActive(true);
            }
            else
            {
                s6.SetActive(false);
            }

            if (TS.CheckSomeTaskFin(10) && Application.loadedLevelName == "Game_02")
            {
                if (GameObject.Find("TV_F") != null)
                {
                    GameObject.Find("TV_F").SetActive(true);
                }
            }
        } // if
    }