Пример #1
0
    //40回目限定
    public bool firstmove(int goal)
    {
        ScoreHolder  d_score = scriptbox.GetComponent <ScoreHolder>();  //スコアを取得
        SE_container se      = scriptbox.GetComponent <SE_container>(); //スコアを取得
        bool         hantei  = false;                                   //
        // var lefttri = new Vector3(-0.2166f, -0.125f, -1);
        //データの引き継ぎ
        Flicked_2 f2 = scriptbox.GetComponent <Flicked_2>();

        targetpos = f2.targetpos;
        nowpos    = f2.nowpos;
        hazurepos = f2.hazurepos;
        Debug.Log("OK");
        if (goal == targetpos)//正解
        {
            before_edge.SetActive(false);
            after_edge.SetActive(true);

            hantei = true;                                      //
            GetComponent <AudioSource>().PlayOneShot(se.atari); //効果音を鳴らす
            relay p0 = childup.GetComponent <relay>();          //スコアを取得
            relay p1 = childleft.GetComponent <relay>();        //スコアを取得
            relay p2 = childright.GetComponent <relay>();       //スコアを取得
            relay px = childnow.GetComponent <relay>();

            //次段階の登場 pattern は無事埋まりました
            pattern = new bool[27];

            //15秒以上待つとおかしくなる問題はこれで解決するしかない!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
            switch (nowpos)
            {
            case 0:
                //  Array.Copy(px.statusback(), pattern, 3);
                p0.set(px.statusback());
                break;

            case 1:
                //  Array.Copy(px.statusback(), 0, pattern, 3, 3);
                p1.set(px.statusback());
                break;

            case 2:
                // Array.Copy(px.statusback(), 0, pattern, 6, 3);
                p2.set(px.statusback());
                break;
            }

            Array.Copy(p0.statusback(), pattern, 9);
            Array.Copy(p1.statusback(), 0, pattern, 9, 9);
            Array.Copy(p2.statusback(), 0, pattern, 18, 9);

            /*
             * for (int i = 0; i < 27; i++)
             * {
             *  Debug.Log(pattern[i]);
             * }
             */

            //Debug.Log(pattern[0] + "," + pattern[1] + "," + pattern[2]);
            triangleup.SetActive(true);
            triangleleft.SetActive(true);
            triangleright.SetActive(true);
            rectTran.DOScale(0.5f, 0.1f);


            switch (nowpos)
            {
            case 0:
                p1.colorchange();
                p2.colorchange();
                break;

            case 1:
                p2.colorchange();
                p0.colorchange();
                break;

            case 2:
                p0.colorchange();
                p1.colorchange();
                break;
            }
            move(goal);
        }
        else
        {
            var uptri    = new Vector3(0, 0.25f, -5);            //
            var lefttri  = new Vector3(-0.2166f, -0.125f, -5);   //
            var righttri = new Vector3(0.2166f, -0.125f, -5);    //

            GetComponent <AudioSource>().PlayOneShot(se.hazure); //効果音を鳴らす
            d_score.left_jiki--;
            d_score.miss();

            var sequence = DOTween.Sequence();
            //追加部分
            switch (goal)
            {
            case 0:
                switch (nowpos)
                {
                case 0:
                    break;

                case 1:
                    sequence.Append(IrectTran.DOLocalMove(uptri, 0.1f));
                    sequence.Append(IrectTran.DOLocalMove(lefttri, 0.05f));
                    break;

                case 2:
                    sequence.Append(IrectTran.DOLocalMove(uptri, 0.1f));
                    sequence.Append(IrectTran.DOLocalMove(righttri, 0.05f));
                    break;
                }
                break;

            case 1:
                switch (nowpos)
                {
                case 0:
                    sequence.Append(IrectTran.DOLocalMove(lefttri, 0.1f));
                    sequence.Append(IrectTran.DOLocalMove(uptri, 0.05f));
                    break;

                case 1:
                    break;

                case 2:
                    sequence.Append(IrectTran.DOLocalMove(lefttri, 0.1f));
                    sequence.Append(IrectTran.DOLocalMove(righttri, 0.05f));
                    break;
                }
                break;

            case 2:
                switch (nowpos)
                {
                case 0:
                    sequence.Append(IrectTran.DOLocalMove(righttri, 0.1f));
                    sequence.Append(IrectTran.DOLocalMove(uptri, 0.05f));
                    break;

                case 1:
                    sequence.Append(IrectTran.DOLocalMove(righttri, 0.1f));
                    sequence.Append(IrectTran.DOLocalMove(lefttri, 0.05f));
                    break;

                case 2:
                    break;
                }

                break;
            }
        }
        return(hantei); //
    }
Пример #2
0
    // フリックジェスチャーが成功すると呼ばれるメソッド
    private void OnFlick(object sender, System.EventArgs e)
    {
        timekeeper     dt = scriptbox.GetComponent <timekeeper>();
        ImportantValue iv = scriptbox.GetComponent <ImportantValue>();
        ScoreHolder    sh = scriptbox.GetComponent <ScoreHolder>();
        stop           st = scriptbox.GetComponent <stop>();

        if (dt.time == 0 && scenemover.gamemode() == 0)
        {
            return;
        }
        if (dt.time_lv4 <= 0 && scenemover.gamemode() == 0)
        {
            return;
        }
        if (dt.coolflag == true && scenemover.gamemode() == 0)
        {
            return;
        }
        if (dt.time_sv <= 0 && scenemover.gamemode() == 1)
        {
            return;
        }
        if (sh.left_jiki < 0 && scenemover.gamemode() == 1)
        {
            return;
        }
        if (st.running == false)
        {
            return;
        }

        ScoreHolder d_score = scriptbox.GetComponent <ScoreHolder>();

        var up    = new Vector3(0, 1, 0);           //上
        var left  = new Vector3(-0.866f, -0.5f, 0); //左下
        var right = new Vector3(0.866f, -0.5f, 0);  //右上


        var gesture = sender as FlickGesture;
        //        string str = "フリック: " + gesture.ScreenFlickVector + " (" + gesture.ScreenFlickTime + "秒)";
        var Fvector = gesture.ScreenFlickVector.normalized;

        //  Vector3.Dot(Fvector, uptri);
        //$$遊び
        switch (iv.jiki)
        {
        case 30:
            zentai.transform.DOShakePosition(0.2f, 1, 10, 90, false, true);
            break;

        case 31:
            zentai.transform.DOShakePosition(1f, 10, 100, 90, false, true);
            break;
        }



        if (Vector3.Dot(Fvector, up) > 0.5f)
        {
            goal = 0;
        }
        if (Vector3.Dot(Fvector, left) > 0.5f)
        {
            goal = 1;
        }
        if (Vector3.Dot(Fvector, right) > 0.5f)
        {
            goal = 2;
        }

        Flicked   f0 = scriptbox.GetComponent <Flicked>();
        Flicked_1 f1 = scriptbox.GetComponent <Flicked_1>();
        Flicked_2 f2 = scriptbox.GetComponent <Flicked_2>();
        Flicked_3 f3 = scriptbox.GetComponent <Flicked_3>();
        Shrink_3  s3 = scriptbox.GetComponent <Shrink_3>();
        shrink_2  s2 = scriptbox.GetComponent <shrink_2>();
        shrink_1  s1 = scriptbox.GetComponent <shrink_1>();
        shrink_0  s0 = scriptbox.GetComponent <shrink_0>();

        if (dt.nowlevel == 0)//ホントに最初
        {
            if (f0.firstmove(goal))
            {
                dt.flag     = true;
                dt.nowlevel = 1;
            }
        }

        else if (dt.flag1 == 0)//最初
        {
            f0.move(goal);
        }
        else if (dt.flag1 == 1)
        {
            if (f1.firstmove(goal))
            {
                dt.flag1 = 2;
            }
            dt.flag = true;
        }
        else if (dt.flag2 == 0)
        {
            f1.move(goal);
        }
        else if (dt.flag2 == 1)
        {
            if (f2.firstmove(goal))
            {
                dt.flag2 = 2;
            }
            dt.flag = true;
        }
        else if (dt.flag3 == 0)
        {
            f2.move(goal);
        }
        else if (dt.flag3 == 1)
        {
            if (f3.firstmove(goal))
            {
                dt.flag3 = 2;
            }
            dt.flag = true;
        }
        else if (dt.flagX3 == 0)
        {
            f3.move(goal);
        }
        else if (dt.flagX3 == 1)
        {
            if (s3.shrink(goal))
            {
                dt.flagX3 = 2;
            }
        }
        else if (dt.flagX2 == 1)
        {
            if (s2.shrink(goal))
            {
                dt.flagX2 = 2;
            }
        }
        else if (dt.flagX1 == 1)
        {
            if (s1.shrink(goal))
            {
                dt.flagX1 = 2;
            }
        }
        else if (dt.LASTflag == 1)
        {
            if (s0.shrink(goal))
            {
                dt.LASTflag = 2;
            }
        }
        else
        {
            //            Debug.Log("もうねえ");
        }
        int var;
        //nextlevel()で全部0に戻される
    }