コード例 #1
0
ファイル: Flicked_1.cs プロジェクト: KMproduction/Ohayou
    //20回目限定
    public bool firstmove(int goal)
    {
        SE_container   se      = scriptbox.GetComponent <SE_container>();   //スコアを取得
        ImportantValue v0      = scriptbox.GetComponent <ImportantValue>(); //スコアを取得
        ScoreHolder    d_score = scriptbox.GetComponent <ScoreHolder>();    //スコアを取得

        bool hantei = false;                                                //
        //       var lefttri = new Vector3(-0.2166f, -0.125f, -1);
        //データの引き継ぎ
        Flicked f1 = scriptbox.GetComponent <Flicked>();

        targetpos = f1.targetpos;
        nowpos    = f1.nowpos;
        hazurepos = f1.hazurepos;
        if (goal == targetpos)//正解
        {
            before_edge.SetActive(false);
            after_edge.SetActive(true);
            hantei = true;//
            //次段階の登場
            pattern            = new bool[3];
            pattern[nowpos]    = true;
            pattern[goal]      = true;
            pattern[hazurepos] = false;
            Debug.Log(pattern[0] + "," + pattern[1] + "," + pattern[2]);

            triangleup.SetActive(true);
            triangleleft.SetActive(true);
            triangleright.SetActive(true);
            rectTran.DOScale(0.5f, 0.1f);
            switch (goal)
            {
            case 0:
                if (v0.matFound == true)
                {
                    childup.GetComponent <SpriteRenderer>().material = v0.jikimat;
                    childup.GetComponent <SpriteRenderer>().color    = Color.white;
                }
                else
                {
                    childup.GetComponent <SpriteRenderer>().color  = Color.white;
                    childup.GetComponent <SpriteRenderer>().sprite = v0.jikispr;
                }
                break;

            case 1:
                if (v0.matFound == true)
                {
                    childleft.GetComponent <SpriteRenderer>().material = v0.jikimat;
                    childleft.GetComponent <SpriteRenderer>().color    = Color.white;
                }
                else
                {
                    childleft.GetComponent <SpriteRenderer>().color  = Color.white;
                    childleft.GetComponent <SpriteRenderer>().sprite = v0.jikispr;
                }
                break;

            case 2:
                if (v0.matFound == true)
                {
                    childright.GetComponent <SpriteRenderer>().material = v0.jikimat;
                    childright.GetComponent <SpriteRenderer>().color    = Color.white;
                }
                else
                {
                    childright.GetComponent <SpriteRenderer>().color  = Color.white;
                    childright.GetComponent <SpriteRenderer>().sprite = v0.jikispr;
                }
                // childright.GetComponent<SpriteRenderer>().color = v0.mycolor;
                // childright.GetComponent<SpriteRenderer>().material = Resources.Load<Material>("Materials/no" + v0.jiki);
                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
ファイル: timekeeper.cs プロジェクト: KMproduction/Ohayou
    public void nextlevel()
    {
        FlickController fc = scriptbox.GetComponent <FlickController>();
        ScoreHolder     sh = scriptbox.GetComponent <ScoreHolder>();
        Flicked         f  = scriptbox.GetComponent <Flicked>();
        ImportantValue  iv = scriptbox.GetComponent <ImportantValue>();
        BackGround      bg = scriptbox.GetComponent <BackGround>();
        unlock          ul = scriptbox.GetComponent <unlock>();

        flag1       = flag2 = flag3 = flagX1 = flagX2 = flagX3 = 0;//ぜーんぶ初期化
        LASTflag    = 0;
        nowlevel    = 0;
        f.targetpos = 0;//上にスワイプして再開
        sh.sv_level++;
        time_sv = iv.sv_PlayTime[(int)sh.sv_level / 2];
        if (sh.sv_level * 5 >= 300)
        {
            time_sv = iv.sv_PlayTime[30];
        }
        time_sv = iv.sv_PlayTime[(int)sh.sv_level / 2];
        Debug.Log("[" + (int)sh.sv_level / 2 + "]でいきます");
        iv.colorReset();
        bg.BGchange(sh.sv_level * 5);
        ul.triunlock(sh.sv_level * 5);

        switch (sh.sv_level * 5)
        {
        case 20:
            sh.left_jiki++;
            break;

        case 40:
            sh.left_jiki++;
            break;

        case 60:
            sh.left_jiki++;
            break;

        case 80:
            sh.left_jiki++;
            break;

        case 100:
            sh.left_jiki++;
            break;

        case 120:
            sh.left_jiki++;
            break;

        case 140:
            sh.left_jiki++;
            break;

        case 160:
            sh.left_jiki++;
            break;

        case 180:
            sh.left_jiki++;
            break;

        case 200:
            sh.left_jiki++;
            break;

        case 220:
            sh.left_jiki++;
            break;

        case 240:
            sh.left_jiki++;
            break;

        case 260:
            sh.left_jiki++;
            break;

        case 280:
            sh.left_jiki++;
            break;

        case 300:
            sh.left_jiki++;
            break;
        }
    }
コード例 #3
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に戻される
    }