Exemple #1
0
    //ステージクリアして次ステージの読み込み
    void stageclear()
    {
        keyflg          = 0;
        stage_clear_flg = 0;
        //まずは過去のstageのもろもろを削除
        for (int i = 0; i < goalnum; i++)//ゴール削除
        {
            Destroy(goalObj[i]);
        }
        goalnum = 0;
        for (int i = 0; i < rareenum; i++)//レアアース削除
        {
            Destroy(rareeObj[i]);
        }
        rareenum = 0;
        for (int i = 0; i < fobjnum; i++)//浮遊オブジェクト削除
        {
            Destroy(objObj[i]);
        }
        fobjnum = 0;



        //ステージ情報を読み込み
        nowstage++; if (nowstage == 9)
        {
            veryfaststageFlg = 0;
        }
        Save();
        if (nowstage == 19)
        {
            SceneManager.LoadScene("Ending");
            nowstage--;
        }

        stagetime = 0.0f;
        Debug.Log("newstage=" + nowstage + "");
        TextAsset textasset = Resources.Load <TextAsset>("data" + nowstage + "");
        string    TextLines = textasset.text;

        textdata = TextLines.Split('\n');//1行ずつに分割

        //各スクリプトに新規stageのloadを
        mnybllts.FillComputeBuffer();
        ldwllinfcomp.stages_speed = float.Parse(textdata[92 + 2 * difficulty]); //ステージごとのスピード倍率設定
        ldwllinfcomp.LoadWallInfo("" + nowstage);                               //これで流体側は読み込まれた
        mnybllts.FillBuffer_F2(dtprtcomp.RYS);                                  //RYSに0.0代入、色のほうはまだ
        dtprtcomp.ResetSomeofRYS(int.Parse(textdata[98]));                      //粒子座標初期化が何フレームで1周するかの倍速。中でsomeofRYSのvram(compute buffer)が再生成されている
        ldwllinfcomp.LoadWallInfo2("" + nowstage);                              //これで粒子側は読み込まれた
        dtprtcomp.someofRYS.Floatload();                                        //登録座標をfloatに変換and展開
        dtprtcomp.someofRYS.ShuffleAndToVram();                                 //クラス内部のvram変数に転送
                                                                                //dtprtcomp.SetRYSC();//これで粒子の初期化も官僚
        frntcomp.LoadNewStage(nowstage);                                        //front stageも読み込み
        bckcomp.LoadNewStage(nowstage);                                         //front stageも読み込み
                                                                                //粒子関連としてRYcを初期化
        mnybllts.FillBuffer_I(dtprtcomp.RYc);

        //ufoの位置初期化
        ucomp.ufo_pos.x         = float.Parse(textdata[0]);
        ucomp.ufo_pos.y         = float.Parse(textdata[2]);
        ucomp.ufo_restart_pos.x = ucomp.ufo_pos.x;
        ucomp.ufo_restart_pos.y = ucomp.ufo_pos.y;
        ucomp.ufo_spd           = new Vector2(0.0f, 0.0f);
        ucomp.grav    = float.Parse(textdata[74 + 2 * difficulty]);         //重力
        ucomp.ufo_rad = 0.0f;                                               //角度初期化
                                                                            //噴射力の設定
        ucomp.jumpf = float.Parse(textdata[80 + 2 * difficulty]);           //噴射力
                                                                            //流れの影響
        ucomp.pullf           = float.Parse(textdata[86 + 2 * difficulty]); //流れのufoに対する影響
        ucomp.forcetoufolimit = float.Parse(textdata[100]);                 //ufoがうける外力最大値
        ucomp.hitpoint        = 128.0f;
        ucomp.fastkey         = 0;
        ucomp.hidamage        = 0;

        //オブジェクト類
        CreateRareearth();
        if (rareenum == 0)//最初からレアアースがないステージなら
        {
            CreateGoal();
        }
        CreateFloatObj();

        //フェードインスプライトはフェードアウト側から直接インスタンス化される
        fadeinflg = 0;
        //stage1 なんとかなんとかっていうスプライトobj生成
        Instantiate(stagenameprefab, new Vector3(1.6f, 0.0f, -0.032f), Quaternion.identity);
        //こいつは自動で消える
    }