Ejemplo n.º 1
0
    //三角形の状態


    public bool shrink(int goal)
    {
        ScoreHolder d_score = scriptbox.GetComponent <ScoreHolder>();//スコアを取得


        SE_container   se = scriptbox.GetComponent <SE_container>();//スコアを取得
        ImportantValue v0 = scriptbox.GetComponent <ImportantValue>();

        bool hantei = false; //
                             // var lefttri = new Vector3(-0.2166f, -0.125f, -1);
                             //データの引き継ぎ(Lv4状態から)



        shrink_1 s1 = scriptbox.GetComponent <shrink_1>();

        targetpos = s1.targetpos;
        nowpos    = s1.nowpos;
        hazurepos = s1.hazurepos;
        Debug.Log("OK");
        if (goal == targetpos)//正解
        {
            d_score.Shrink();
            GetComponent <AudioSource>().PlayOneShot(se.clear); //効果音を鳴らす
            hantei = true;                                      //

            //  targetpos = 0;//次につなげていく

            //※他の三角形(3_tri)はいらない、inactiveにしてよい
            //""""""""""""""""""""""""""""""遅延して消えた方が美しい
            //         triangleup.SetActive(false);
            //         triangleleft.SetActive(false);
            //         triangleright.SetActive(false);
            DOVirtual.DelayedCall(0.1f, () => triangleup.SetActive(false));
            DOVirtual.DelayedCall(0.1f, () => triangleleft.SetActive(false));
            DOVirtual.DelayedCall(0.1f, () => triangleright.SetActive(false));
            //bigbigbigtriamgleが拡大する=元に戻る

            bigrectTran.DOLocalMove(new Vector3(0, 0, -10), 0.1f);//flick3のみ、親も戻る
            bigrectTran.DOScale(1, 0.1f);
        }
        else
        {
            GetComponent <AudioSource>().PlayOneShot(se.hazure); //効果音を鳴らす
                                                                 //減点
            d_score.Shrinkmiss();
            d_score.left_jiki--;

            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);  //
            var sequence = DOTween.Sequence();
            switch (goal)
            {
            case 0:
                switch (nowpos)
                {
                case 0:
                    break;

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

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

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

                case 1:
                    break;

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

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

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

                case 2:
                    break;
                }

                break;
            }
        }


        return(hantei); //
    }
Ejemplo n.º 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に戻される
    }