コード例 #1
0
ファイル: ImportantValue.cs プロジェクト: KMproduction/Ohayou
    void Start()
    {
        //jsonの初回ロード
        json = File.ReadAllText(Application.persistentDataPath + "/data.json");//読み取ってるよ
        savedata sv = new savedata();

        json = encryption.DecryptString(json);
        JsonUtility.FromJsonOverwrite(json, sv);//読み取ったのを変換してるよ
        jiki = sv._jiki;
        //jiki = 10;

        //ここから
        if (jikimat = Resources.Load <Material>("Materials/no" + jiki))
        {
            firsttriangle.GetComponent <SpriteRenderer>().material = jikimat;
            Debug.Log(jiki + "じゃん");
            matFound = true;
        }
        else
        {
            jikispr = Resources.Load <Sprite>("Materials/no" + jiki);
            firsttriangle.GetComponent <SpriteRenderer>().sprite = jikispr;
            Debug.Log("ないじゃn");
        }
        //ここまで

        //自機色決定
        //        mycolor = new Color(0, 1, 1, 1);
        //
        //自機色決定
        //        mycolor = new Color(0, 1, 1, 1);
        //        aroundcolor = new Color(1, 0, 1, 1);

        firsttriangle.GetComponent <SpriteRenderer>().color = mycolor;



        firsttriangle.GetComponent <SpriteRenderer>().color = mycolor;


        //周りの色決定
        patternset pm     = BigTriangleNOW.GetComponent <patternset>();
        relay      pmm    = BigBigTriangleNOW.GetComponent <relay>();
        relay1     pmmm   = BigBigBigTriangleNOW.GetComponent <relay1>();
        relay1     pup    = Triup_third.GetComponent <relay1>();
        relay1     pleft  = Trileft_third.GetComponent <relay1>();
        relay1     pright = Triright_third.GetComponent <relay1>();

        pm.aroundcolorchange();
        pmm.aroundcolorchange();
        pmmm.aroundcolorchange();
        pup.aroundcolorchange();
        pleft.aroundcolorchange();
        pright.aroundcolorchange();

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

        se.SEswitch(sv._sound);
        se.BGMswitch(sv._BGM);
    }
コード例 #2
0
    public void aroundcolorchange()
    {
        patternset p0 = triup.GetComponent <patternset>();
        patternset p1 = trileft.GetComponent <patternset>();
        patternset p2 = triright.GetComponent <patternset>();

        p0.aroundcolorchange();
        p1.aroundcolorchange();
        p2.aroundcolorchange();
    }
コード例 #3
0
    public void set(bool[] pattern)
    {
        patternset p0 = triup.GetComponent <patternset>();
        patternset p1 = trileft.GetComponent <patternset>();
        patternset p2 = triright.GetComponent <patternset>();

        p0.set(new bool[] { pattern[0], pattern[1], pattern[2] });
        p1.set(new bool[] { pattern[3], pattern[4], pattern[5] });
        p2.set(new bool[] { pattern[6], pattern[7], pattern[8] });
    }
コード例 #4
0
    public bool[] statusback()
    {
        patternset p0 = triup.GetComponent <patternset>();
        patternset p1 = trileft.GetComponent <patternset>();
        patternset p2 = triright.GetComponent <patternset>();

        bool[] statusall = new bool[9];
        Array.Copy(p0.statusback(), statusall, 3);
        Array.Copy(p1.statusback(), 0, statusall, 3, 3);
        Array.Copy(p2.statusback(), 0, statusall, 6, 3);

        return(statusall);
    }
コード例 #5
0
ファイル: ImportantValue.cs プロジェクト: KMproduction/Ohayou
    public void colorReset()
    {
        patternset pm     = BigTriangleNOW.GetComponent <patternset>();
        relay      pmm    = BigBigTriangleNOW.GetComponent <relay>();
        relay1     pmmm   = BigBigBigTriangleNOW.GetComponent <relay1>();
        relay1     pup    = Triup_third.GetComponent <relay1>();
        relay1     pleft  = Trileft_third.GetComponent <relay1>();
        relay1     pright = Triright_third.GetComponent <relay1>();

        pm.aroundcolorchange();
        pmm.aroundcolorchange();
        pmmm.aroundcolorchange();
        pup.aroundcolorchange();
        pleft.aroundcolorchange();
        pright.aroundcolorchange();
    }
コード例 #6
0
    // Use this for initialization
    public void setrand(bool[] pattern)//9要素
    {
        patternset p0 = triup.GetComponent <patternset>();
        patternset p1 = trileft.GetComponent <patternset>();
        patternset p2 = triright.GetComponent <patternset>();

        int rand = UnityEngine.Random.Range(0, 6);//0~3を生成

        switch (rand)
        {
        case 0:
            p0.set(new bool[] { pattern[0], pattern[1], pattern[2] });
            p1.setrand(new bool[] { pattern[3], pattern[4], pattern[5] });
            p2.setrand(new bool[] { pattern[6], pattern[7], pattern[8] });
            break;

        case 1:
            p0.setrand(new bool[] { pattern[0], pattern[1], pattern[2] });
            p1.set(new bool[] { pattern[3], pattern[4], pattern[5] });
            p2.setrand(new bool[] { pattern[6], pattern[7], pattern[8] });
            break;

        case 2:
            p0.setrand(new bool[] { pattern[0], pattern[1], pattern[2] });
            p1.setrand(new bool[] { pattern[3], pattern[4], pattern[5] });
            p2.set(new bool[] { pattern[6], pattern[7], pattern[8] });
            break;

        case 3:    //完全ランダム
            p0.setrand(new bool[] { pattern[0], pattern[1], pattern[2] });
            p1.setrand(new bool[] { pattern[3], pattern[4], pattern[5] });
            p2.setrand(new bool[] { pattern[6], pattern[7], pattern[8] });
            break;

        case 4:    //完全ランダム
            p0.setrand(new bool[] { pattern[0], pattern[1], pattern[2] });
            p1.setrand(new bool[] { pattern[3], pattern[4], pattern[5] });
            p2.setrand(new bool[] { pattern[6], pattern[7], pattern[8] });
            break;

        case 5:    //完全ランダム
            p0.setrand(new bool[] { pattern[0], pattern[1], pattern[2] });
            p1.setrand(new bool[] { pattern[3], pattern[4], pattern[5] });
            p2.setrand(new bool[] { pattern[6], pattern[7], pattern[8] });
            break;
        }
    }
コード例 #7
0
ファイル: Flicked_1.cs プロジェクト: KMproduction/Ohayou
    void triset()//三角形の再配置
    {
        //正解の配置
        patternset p0 = triangleup.GetComponent <patternset>();    //スコアを取得
        patternset p1 = triangleleft.GetComponent <patternset>();  //スコアを取得
        patternset p2 = triangleright.GetComponent <patternset>(); //スコアを取得

        switch (targetpos)
        {
        case 0:
            p0.set(pattern);
            break;

        case 1:
            p1.set(pattern);
            break;

        case 2:
            p2.set(pattern);
            break;
        }

        //不正解の配置
        switch (hazurepos)
        {
        case 0:
            p0.setrand(pattern);
            p0.kinsoku(pattern);
            break;

        case 1:
            p1.setrand(pattern);
            p1.kinsoku(pattern);
            break;

        case 2:
            p2.setrand(pattern);
            p2.kinsoku(pattern);
            break;
        }
    }
コード例 #8
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_1 f1 = scriptbox.GetComponent <Flicked_1>();

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

            hantei = true;//


            patternset p0 = childup.GetComponent <patternset>();    //スコアを取得
            patternset p1 = childleft.GetComponent <patternset>();  //スコアを取得
            patternset p2 = childright.GetComponent <patternset>(); //スコアを取得
            patternset px = childnow.GetComponent <patternset>();


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

            //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, 3);
            Array.Copy(p1.statusback(), 0, pattern, 3, 3);
            Array.Copy(p2.statusback(), 0, pattern, 6, 3);



            for (int i = 0; i < 9; 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); //
    }
コード例 #9
0
    //40回目限定
    public bool shrink(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);
                                     //データの引き継ぎ(Lv4状態から)



        Shrink_3 s3 = scriptbox.GetComponent <Shrink_3>();

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

            GetComponent <AudioSource>().PlayOneShot(se.shrink2); //効果音を鳴らす
            hantei = true;                                        //
            d_score.Shrink();


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

            //    triangleup.SetActive(false);
            //    triangleleft.SetActive(false);
            //    triangleright.SetActive(false);
            //bigbigbigtriamgleが拡大する=元に戻る

            bigrectTran.DOLocalMove(new Vector3(0, 0, -10), 0.1f);//flick3のみ、親も戻る
            bigrectTran.DOScale(1, 0.1f);
            //  rectTran.DOLocalMove(new Vector3(0, 0, -10), 0.1f);


            patternset p0        = childup.GetComponent <patternset>();    //スコアを取得
            patternset p1        = childleft.GetComponent <patternset>();  //スコアを取得
            patternset p2        = childright.GetComponent <patternset>(); //スコアを取得
            patternset px        = childnow.GetComponent <patternset>();
            bool[]     p0pattern = new bool[3];
            bool[]     p1pattern = new bool[3];
            bool[]     p2pattern = new bool[3];
            bool[]     pxpattern = new bool[3];
            Array.Copy(p0.statusback(), p0pattern, 3);
            Array.Copy(p1.statusback(), p1pattern, 3);
            Array.Copy(p2.statusback(), p2pattern, 3);
            Array.Copy(px.statusback(), pxpattern, 3);
            int yabaiflag = 1;

            int key = (int)(childnow.transform.localPosition.x * 10) + 2;
            //次のプレイヤーの位置(bigbigtriの)場所をじかに求める-2…左 0…上 2…右
            Debug.Log(key + "にいるぞ!!!");
            switch (key) //nowのある場所
                         //	bigbigtriangleがプレイヤー色のままだが、他の子(2_tri)は背景色に戻す
            {
            case 0:      //左
                p2.aroundcolorchange();
                p0.aroundcolorchange();
                p1.aroundcolorchange();    //追加
                nowpos = 1;

                //p0pattern== pxpatternの判定
                for (int i = 0; i < 3; i++)
                {
                    if (p0pattern[i] != pxpattern[i])    //2なら
                    {
                        targetpos = 2;
                        hazurepos = 0;
                        yabaiflag = 0;
                        break;
                    }
                    if (p2pattern[i] != pxpattern[i])    //0なら
                    {
                        targetpos = 0;
                        hazurepos = 2;
                        yabaiflag = 0;
                        break;
                    }
                }
                break;

            case 2:    //上
                p1.aroundcolorchange();
                p2.aroundcolorchange();
                p0.aroundcolorchange();    //追加
                nowpos = 0;

                for (int i = 0; i < 3; i++)
                {
                    if (p2pattern[i] != pxpattern[i])    //1なら
                    {
                        targetpos = 1;
                        hazurepos = 2;
                        yabaiflag = 0;
                        break;
                    }
                    if (p1pattern[i] != pxpattern[i])    //2なら
                    {
                        targetpos = 2;
                        hazurepos = 1;
                        yabaiflag = 0;
                        break;
                    }
                }
                break;

            case 4:    //右
                p0.aroundcolorchange();
                p1.aroundcolorchange();
                p2.aroundcolorchange();
                nowpos = 2;

                for (int i = 0; i < 3; i++)
                {
                    if (p1pattern[i] != pxpattern[i])    //0なら
                    {
                        targetpos = 0;
                        hazurepos = 1;
                        yabaiflag = 0;
                        break;
                    }
                    if (p0pattern[i] != pxpattern[i])    //1なら
                    {
                        targetpos = 1;
                        hazurepos = 0;
                        yabaiflag = 0;
                        break;
                    }
                }

                break;
            }
            Debug.Log("targetpos =" + targetpos + ",hazurepos =" + hazurepos + "nowpos=" + nowpos);
            if (yabaiflag == 1)
            {
                Debug.Log("えええええええええええええなんでsssssっせえええええええええええええええええええええええええええええ");
            }


            px.colorchange();

            // move(goal);
        }
        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); //
    }