Exemple #1
0
    // Update is called once per frame
    void Update()
    {
        //SHOW MOVE
        if (MovieOn)
        {
            //  print(Math.Round(Time.time - PlayTime, 1));
            if (Math.Round(Time.time - PlayTime, 1) == 1.2)
            {
                showPicture('A');
                print("inshowA");
            }
            if (Math.Round(Time.time - PlayTime, 1) == 3.3)
            {
                showPicture('D');
                print("inshowD");
            }
        }

        if ((Time.time - KKKEEP) > 1.0f && tempkeep)
        {
            showcount   = 0;
            playercount = 0;
            cantouch    = false;
            tempkeep    = false;
        }

        //SHOW WIN
        if (KK && counti < WINNUM && counti >= 0)
        {
            WIN[counti].SetActive(true);
            Text.text = "counti" + counti;
        }
        else if (counti == WINNUM)
        {
            SceneManager.LoadScene("G2End", LoadSceneMode.Single);
        }

        #region if cantouch
        if (cantouch)
        {
            if (currentlevel == 0)
            {
                if (!nowplaying)
                {
                    PlayAnimation();
                    winwintime = Time.time;
                    nowplaying = true;
                }

                else if (Time.time - winwintime > 4.8 && currentlevel == 0)
                {
                    Da.SetActive(false); Db.SetActive(false); Dc.SetActive(false); Dd.SetActive(false); De.SetActive(false);
                    Hand.SetActive(false);
                    currentlevel++;
                    showcount   = 0;
                    cantouch    = false;
                    playercount = 0;
                    Last        = 'F';
                }
            }

            else
            {
                //	print("level up!");

                if ((A && Last != 'A') || Input.GetKeyDown(KeyCode.A))
                {
                    Last = 'A';
                    PlayLightBall(1);
                }
                else if ((B && Last != 'B') || Input.GetKeyDown(KeyCode.B))
                {
                    Last = 'B';
                    PlayLightBall(2);
                }
                else if ((C && Last != 'C') || Input.GetKeyDown(KeyCode.C))
                {
                    Last = 'C';
                    PlayLightBall(3);
                }

                else if ((D && Last != 'D') || Input.GetKeyDown(KeyCode.D))
                {
                    Last = 'D';
                    PlayLightBall(4);
                }

                else if ((E && Last != 'E') || Input.GetKeyDown(KeyCode.E))
                {
                    Last = 'E';
                    PlayLightBall(5);
                }

                //else if (!A && !B && !C && !D && !E)
                //{
                //    showPicture('N');
                //}
            }

            // print(Last);

            //實際測試要記得打開,要記得調Timer設定
        }
        #endregion
    }
Exemple #2
0
    //int frameRate = 250;

    // Use this for initialization
    void Start()
    {
        //  Time.captureFramerate = frameRate;

        Time.fixedDeltaTime = 1.0f;
        Pa.SetActive(false);
        Pb.SetActive(false);
        Pc.SetActive(false);
        Pd.SetActive(false);
        Pe.SetActive(false);
        Pwin.SetActive(false);
        Pnon.SetActive(true);
        Pwrong.SetActive(false);
        Pnext.SetActive(false);
        Pnext1.SetActive(false);
        NEXTL.SetActive(false);

        animatorhand = Hand.GetComponent <Animator>();
        //print(animatorhand.GetInstanceID ());

        La.SetActive(false); Ld.SetActive(false);
        Da.SetActive(false); Db.SetActive(false); Dc.SetActive(false); Dd.SetActive(false); De.SetActive(false); Hand.SetActive(false);
        whichF       = 0;
        nowKeep      = 0;
        showcount    = 0;
        playercount  = 0;
        currentlevel = 0;

        Last       = 'F';
        nowplaying = false;

        int temptnum;

        #region random
        System.Random randNum = new System.Random();


        for (int i = 0; i < flowerlight_L0.Length;)
        {
            temptnum = randNum.Next(Min, Max);
            if (i == 0)
            {
                flowerlight_L0[i] = 0;
                i++;
            }

            else if (i == 1)
            {
                flowerlight_L0[i] = 1;
                i++;
            }

            else if (i == 2)
            {
                flowerlight_L0[i] = 4;
                i++;
            }
        }

        for (int i = 0; i < flowerlight_L1.Length;)
        {
            temptnum = randNum.Next(Min, Max);
            if (i == 0)
            {
                flowerlight_L1[i] = 0;
                i++;
            }

            else if (temptnum != flowerlight_L1[i - 1])
            {
                flowerlight_L1[i] = temptnum;
                i++;
            }
        }

        for (int i = 0; i < flowerlight_L2.Length;)
        {
            temptnum = randNum.Next(Min, Max);
            if (i == 0)
            {
                flowerlight_L2[i] = 0;
                i++;
            }

            else if (temptnum != flowerlight_L2[i - 1])
            {
                flowerlight_L2[i] = temptnum;
                i++;
            }
        }

        for (int i = 0; i < flowerlight_L3.Length;)
        {
            temptnum = randNum.Next(Min, Max);
            if (i == 0)
            {
                flowerlight_L3[i] = 0;
                i++;
            }

            else if (temptnum != flowerlight_L3[i - 1])
            {
                flowerlight_L3[i] = temptnum;
                i++;
            }
        }
        #endregion
        cantouch = false;
        tempkeep = false;

        #region show WIN
        for (int i = 0; i < WINNUM; i++)
        {
            WIN[i].SetActive(false);
        }
        KK = false;
        #endregion
    }
Exemple #3
0
 void PlayAnimation()
 {
     Da.SetActive(true); Db.SetActive(true); Dc.SetActive(true); Dd.SetActive(true); De.SetActive(true);
     Hand.SetActive(true);
     PlayTime = Time.time;
     MovieOn  = true;
 }