2020年8月29日土曜日

作ったゲームのスクリプトを公開してみた

未だにプログラムなにもわかりません。


Unityと出会ってからずいぶん経ちましたが、その間ずーっと独学のC#でスクリプトを書いているので、


「そういえば自分のプログラムの書き方って正しいの?というかまともなの??他の人がみたらどう思うの???」


と疑問に思ってしまいました。なので今回unity1weekで投稿した「コケモドキと魔女」というゲームの管理者であるGame_Directorさんのスクリプトを公開してみようと思います。



通常ならgitにプロジェクトを上げたので見てください!とかそんな感じだと思うのですが、gitぜんぜん分からないのでブログにそのまま載せようと思います。気軽に見れてよい。

書くスペースが膨大になってしまうので、ゲームシーンを統括するGame_Directorさんのスクリプトのみご覧いただければと思います。そもそもそんなクラスが存在すること自体あってるのかわからぬ。


プロのプログラマーの方が見たらあまりにひどくて泣いちゃうかもしれないので先に誤っておきます。すみません。あと脳が疲れるので配列は使っていません。すみません。アニメーション機能がよくわからないので基本的に画像のオンオフです。すみません。

思ったことなど率直な感想をいただけると嬉しいなって思います。ただ返事をする余裕というか知識があるのかわからないので返事には期待しないでいただけるとありがたいです、ごめんなさい。土下座の大洪水。



using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
using Doozy.Engine.UI;
using NCMB;

public class Game_Director : MonoBehaviour
{
    // ゲームシーン01を管理するすくりぷと

    int move = 1; // 1でゲームON、0で停止
    int enemy_count = 0; // マウスなどの敵出現カウント
    int rand_enemytime = 500; // 次の敵出現までの時間
    int enemy_tipe = 0; // 敵出現ポイントランダム
    public GameObject Enemy_makerR; // 敵出現ポイント
    public GameObject Enemy_makerL;
    public GameObject Enemy_maker_upR;
    public GameObject Enemy_maker_upL;

    int score = 0; // 苔のスコア、ランキング用
    //int Score_okkake = 0; // 追っかけ表示用
    //public GameObject Score_text; // スコア表示
    int gaji = 0; // ステージ下の苔ゲージ
    // 0~100の数値、gaji10につき1個trueで10個溜まる(100)と苔出現でリセット
    public GameObject gaji_Image01; // ステージ下の苔画像
    public GameObject gaji_Image02; // ステージ下の苔画像
    public GameObject gaji_Image03;
    public GameObject gaji_Image04;
    public GameObject gaji_Image05;
    public GameObject gaji_Image06;
    public GameObject gaji_Image07;
    public GameObject gaji_Image08;
    public GameObject gaji_Image09;
    public GameObject gaji_Image10;
    int kokegaji_count = 0; // こけげーじ用のふわ苔en出現用
    int kokegaji_rand = 100; // こけふわ出現MAX値
    public GameObject Enemy_makerM; // 中央下のen苔出現point
    public GameObject Koke_maker; // こけめいかー
    int koke_kaisuu = 0; // 苔を出現させた回数
    int koke_randtipe = 0; // 苔の種類ランダム
    int koke_randtipe2 = 0; // 苔の種類ランダム2
    public GameObject koke_text; // 苔の名前
    public GameObject hyouka_text; // 評価:999
    public GameObject serifu_text; // 魔女セリフテキスト
    float hyouka_rand = 0; // 評価点数ランダム
    float hyouka_point = 0;// 最終的な評価点数
    float hyouka_plusrand = 0; // プラスのランダム部分
    int rand_koketipe00 = 0; // ランダムで苔の種類が決まる後半
    int rand_koketipe002 = 0;
    int ranking_flag = 0; // ランキングふらぐ(連続でのランキング呼び出し禁止)
    public GameObject ranking_oukanImage;//フラグOFFの時は王冠消す
    public GameObject SE_Director; // おと
    public GameObject Button_L_sumaho; // スマホボタンを押してONおFF
    public GameObject Button_R_sumaho;
    public GameObject Button_J_sumaho;
    int sumaho_flag = 0; // すまほONOFFフラグ
    public Slider _slider; // 画面下の苔スライダー


    void Start()
    {
        //enemy_tipe = Random.Range(0, 4); // 敵出現ポイントランダム
        /*
        this.Score_text.GetComponent<Text>().text =
              Score_okkake.ToString();*/
        Invoke("Start_setumei01", 20); // 開始時のゲーム説明
    }
    void Start_setumei01()
    {
        serifu_text_View.Hide();//セリフ位置リセット
        serifu_text_View.Show();//セリフ右から左
        this.serifu_text.GetComponent<Text>().text =
          "コケモドキが生まれたら、それに触れ続けることで採集できるわ。";
    }

    
    void FixedUpdate()
    {
        if (move == 1) // ゲームON
        {
            enemy_count += 1;
            if (enemy_count >= rand_enemytime)
            {
                if (enemy_tipe == 0) // ねずみ
                {
                    this.Enemy_makerR.GetComponent<Enemy_maker>().enemy_make01();
                }
                else if (enemy_tipe == 1) // ねずみひだり
                {
                    this.Enemy_makerL.GetComponent<Enemy_maker>().enemy_make01();
                }
                else if (enemy_tipe == 2) //さかな
                {
                    this.Enemy_maker_upR.GetComponent<Enemy_maker>().enemy_make01();
                }
                else if (enemy_tipe == 3) // さかなひだり
                {
                    this.Enemy_maker_upL.GetComponent<Enemy_maker>().enemy_make01();
                }
                enemy_count = 0;
                rand_enemytime = Random.Range(200, 800);
                enemy_tipe = Random.Range(0, 4); // 敵出現ポイントランダム
            }
            kokegaji_count += 1;
            if (kokegaji_count >= kokegaji_rand) // 下からのふわこけen
            {
                this.Enemy_makerM.GetComponent<Enemy_maker>().enemy_make01();
                kokegaji_rand = Random.Range(30, 150);
                kokegaji_count = 0;
            }
        }
    }
    public void Ranking_oukan() // ランキング呼び出し
    {
naichilab.RankingLoader.Instance.SendScoreAndShowRanking(hyouka_point);
        ranking_oukanImage.SetActive(false); // 王冠OFF
        SE_Director.GetComponent<SE_Director>().SE_Ranking01(); // rankinguoto
    }


    public void gaji_plus2() // ふわこけen
    {
        gaji += 10;
        gaji_koke();
        SE_Director.GetComponent<SE_Director>().SE_Kokeen01(); // こけen獲得おと
    }
    public void gaji_plus5() // ねずみ
    {
        gaji += 20;
        this.Enemy_makerM.GetComponent<Enemy_maker>().enemy_make01();
        this.Enemy_makerM.GetComponent<Enemy_maker>().enemy_make01();
        this.Enemy_makerM.GetComponent<Enemy_maker>().enemy_make01();
        gaji_koke();
        SE_Director.GetComponent<SE_Director>().SE_Enemy01(); // ねずみおと
    }
    public void gaji_plus8() // さかな
    {
        gaji += 30;
        this.Enemy_makerM.GetComponent<Enemy_maker>().enemy_make01();
        this.Enemy_makerM.GetComponent<Enemy_maker>().enemy_make01();
        this.Enemy_makerM.GetComponent<Enemy_maker>().enemy_make01();
        this.Enemy_makerM.GetComponent<Enemy_maker>().enemy_make01();
        this.Enemy_makerM.GetComponent<Enemy_maker>().enemy_make01();
        this.Enemy_makerM.GetComponent<Enemy_maker>().enemy_make01();
        this.Enemy_makerM.GetComponent<Enemy_maker>().enemy_make01();
        gaji_koke();
        SE_Director.GetComponent<SE_Director>().SE_Enemy01(); // さかなおと
    }


    public void gaji_koke()
    {        
        if (gaji >= 10)
        {
            gaji_Image01.SetActive(true); // ステージ下の苔ゲージON
        }
        if (gaji >= 20)
        {
            gaji_Image02.SetActive(true); // ステージ下の苔ゲージON
        }
        if (gaji >= 30)
        {
            gaji_Image03.SetActive(true);
        }
        if (gaji >= 40)
        {
            gaji_Image04.SetActive(true);
        }
        if (gaji >= 50)
        {
            gaji_Image05.SetActive(true);
        }
        if (gaji >= 60)
        {
            gaji_Image06.SetActive(true);
        }
        if (gaji >= 70)
        {
            gaji_Image07.SetActive(true);
        }
        if (gaji >= 80)
        {
            gaji_Image08.SetActive(true);
        }
        if (gaji >= 90)
        {
            gaji_Image09.SetActive(true);
        }
        if (gaji >= 100)
        {
            gaji_Image10.SetActive(true);
        }
        if (gaji >= 110) // ステージ下のこけ全OFF
        {
            gaji_Image01.SetActive(false);
            gaji_Image02.SetActive(false);
            gaji_Image03.SetActive(false);
            gaji_Image04.SetActive(false);
            gaji_Image05.SetActive(false);
            gaji_Image06.SetActive(false);
            gaji_Image07.SetActive(false);
            gaji_Image08.SetActive(false);
            gaji_Image09.SetActive(false);
            gaji_Image10.SetActive(false);

            // 以下、苔出現に関する部分

            koke_kaisuu += 1; // 苔出現回数+1、ふえるとレア苔とか出現?            
            
            if (koke_kaisuu <= 1) // 最初の苔
            {
                this.Koke_maker.GetComponent<Koke_maker>().koke_make00_2();//中苔
            }
            if (koke_kaisuu == 2) // 2番目の苔
            {
                this.Koke_maker.GetComponent<Koke_maker>().koke_make01();//キノコ
            }
            else if ((koke_kaisuu > 2) && (koke_kaisuu <= 15)) // 開始から数回
            {
                koke_randtipe = Random.Range(0, 5); // それぞれ1/4
                if (koke_randtipe == 0)
                {
                    this.Koke_maker.GetComponent<Koke_maker>().koke_make00();//小苔
                }
                else if (koke_randtipe == 1)
                {
                    this.Koke_maker.GetComponent<Koke_maker>().koke_make00_2();//中苔
                }
                else if (koke_randtipe == 2)
                {
                    this.Koke_maker.GetComponent<Koke_maker>().koke_make00_3();//大苔
                }
                else if (koke_randtipe == 3)
                {
                    this.Koke_maker.GetComponent<Koke_maker>().koke_make01();//キノコ
                }
                else if (koke_randtipe == 4)
                {
                    this.Koke_maker.GetComponent<Koke_maker>().koke_make01_2();//キノココケモドキ
                }
            }
            else if (koke_kaisuu > 15) // 15回目以降
            {
                koke_randtipe = Random.Range(0, 6); // 0~5の6とおり
                if (koke_randtipe == 0)
                {
                    this.Koke_maker.GetComponent<Koke_maker>().koke_make00();//小苔
                }
                else if (koke_randtipe == 1)
                {
                    this.Koke_maker.GetComponent<Koke_maker>().koke_make00_2();//中苔
                }
                else if (koke_randtipe == 2)
                {
                    this.Koke_maker.GetComponent<Koke_maker>().koke_make00_3();//大苔
                }
                else if (koke_randtipe == 3)
                {
                    this.Koke_maker.GetComponent<Koke_maker>().koke_make01();//キノコ
                }
                else if (koke_randtipe == 4)
                {
                    this.Koke_maker.GetComponent<Koke_maker>().koke_make01_2();//キノココケモドキ
                }
                else if (koke_randtipe == 5)
                {
                    this.Koke_maker.GetComponent<Koke_maker>().koke_make02();//neko
                }
            }
            
            gaji = 0; // リセット
        }// ここまで苔ゲージ溜まったとき
        _slider.value = gaji;//画面下スライダに反映
    }// ここまで苔系獲得に関する

    
    // 以下コケモドキ名に関する部分、名前変更や評価、そのアニメなど
    // それぞれのkoke01から命令が飛んでくる
    [SerializeField] private UIView koke_namaeView = null;
    [SerializeField] private UIView koke_imageView = null;
    [SerializeField] private UIView hyouka_View = null;
    [SerializeField] private UIView hyouka_imageView = null;
    [SerializeField] private UIView kakutoku_View = null;
    [SerializeField] private UIView serifu_text_View = null;
    public void koke_hakken00() // 小苔
    {
        
        name_Hide(); // 名前と評価アニメ準備
        rand_koketipe00 = Random.Range(0, 3); // こけたいぷ名らんだむ
        if (rand_koketipe00 == 0)
        {
            hyouka_rand = Random.Range(80, 180); // 評価値ランダム
            this.koke_text.GetComponent<Text>().text =
            "チビコケモドキ";
            //this.serifu_text.GetComponent<Text>().text =  (文字数MAX例)
            //"移動:←→ああジャンプ:Spaceキーああ二段ジャンプOKああああああああああ";
            this.serifu_text.GetComponent<Text>().text =
            "小さい種類のコケモドキね。 かわいいから人気があるのよ。 私の中では。";
            SE_Director.GetComponent<SE_Director>().SE_Kokenamae01();
        }
        else if (rand_koketipe00 == 1)
        {
            hyouka_rand = Random.Range(130, 230);
            this.koke_text.GetComponent<Text>().text =
            "ミニコケモドキ";
            this.serifu_text.GetComponent<Text>().text =
           "チビコケモドキとの違いが分かりづらいのよね。 どこが違うのか未だに謎。";
            SE_Director.GetComponent<SE_Director>().SE_Kokenamae01();
        }
        else if (rand_koketipe00 == 2)
        {
            hyouka_rand = Random.Range(200, 306);
            this.koke_text.GetComponent<Text>().text =
            "ミニチュアモ";
            this.serifu_text.GetComponent<Text>().text =
           "小さくてなかなか見つからない貴重なコケモドキよ! よく見つけたわね!";
            SE_Director.GetComponent<SE_Director>().SE_Kokenamae03();
        }
        name_Show();// 名前と評価アニメ
        
    }
    public void koke_hakken00_2() // 中古家
    {
        name_Hide(); // 名前と評価アニメ準備
        rand_koketipe00 = Random.Range(0, 3); // こけたいぷ名らんだむ
        if (rand_koketipe00 == 0)
        {
            hyouka_rand = Random.Range(80, 180); // 評価値ランダム
            this.koke_text.GetComponent<Text>().text =
            "ナカコケモドキ";
            this.serifu_text.GetComponent<Text>().text =
           "コケモドキの中にはよくコケモドキが存在するらしいわ。 深すぎるわね…。";
            SE_Director.GetComponent<SE_Director>().SE_Kokenamae01();
        }
        else if (rand_koketipe00 == 1)
        {
            hyouka_rand = Random.Range(120, 220);
            this.koke_text.GetComponent<Text>().text =
            "フツウコケモドキ";
            this.serifu_text.GetComponent<Text>().text =
           "コケモドキといえばこれ、という感じのふつうのやつ。 普通が一番よね。";
            SE_Director.GetComponent<SE_Director>().SE_Kokenamae01();
        }
        else if (rand_koketipe00 == 2)
        {
            rand_koketipe002 = Random.Range(0, 5); // 特別苔
            if (rand_koketipe002 == 0)
            {
                if (koke_kaisuu > 20)
                {
                    hyouka_rand = Random.Range(250, 296);
                    this.koke_text.GetComponent<Text>().text =
                    "パフモドキ";
                    this.serifu_text.GetComponent<Text>().text =
                   "これは…何かしら…? 見たことがないコケモドキだわ…新発見かも…。";
                    SE_Director.GetComponent<SE_Director>().SE_Kokenamae03();
                }
                else
                {
                    hyouka_rand = Random.Range(150, 260);
                    this.koke_text.GetComponent<Text>().text =
                    "ミドルコケモドキ";
                    this.serifu_text.GetComponent<Text>().text =
                   "上級でもなく下級でもない…まさにコケモドキね。 良いものだわ!";
                    SE_Director.GetComponent<SE_Director>().SE_Kokenamae01();
                }
            }
            else
            {
                hyouka_rand = Random.Range(150, 260);
                this.koke_text.GetComponent<Text>().text =
                "ミドルコケモドキ";
                this.serifu_text.GetComponent<Text>().text =
               "上級でもなく下級でもない…まさにコケモドキね。 良いものだわ!";
                SE_Director.GetComponent<SE_Director>().SE_Kokenamae01();
            }
        }
            
        name_Show();// 名前と評価アニメ
    }
    public void koke_hakken00_3() // 大苔
    {
        name_Hide(); // 名前と評価アニメ準備
        rand_koketipe00 = Random.Range(0, 3); // こけたいぷ名らんだむ
        if (rand_koketipe00 == 0)
        {
            hyouka_rand = Random.Range(140, 250); // 評価値ランダム
            this.koke_text.GetComponent<Text>().text =
            "オオコケモドキ";
            this.serifu_text.GetComponent<Text>().text =
           "大きいコケモドキは一般にオオコケモドキと呼ばれるわ。 力こそパワーね。";
            SE_Director.GetComponent<SE_Director>().SE_Kokenamae01();
        }
        else if (rand_koketipe00 == 1)
        {
            hyouka_rand = Random.Range(80, 180);
            this.koke_text.GetComponent<Text>().text =
            "デカイコケモドキ";
            this.serifu_text.GetComponent<Text>().text =
           "デカイコケモドキの影に隠れてミニコケモドキが見えなくなることがあるわ。";
            SE_Director.GetComponent<SE_Director>().SE_Kokenamae01();
        }
        else if (rand_koketipe00 == 2)
        {
            hyouka_rand = Random.Range(196, 306);
            this.koke_text.GetComponent<Text>().text =
            "ビッグバンモドキ";
            this.serifu_text.GetComponent<Text>().text =
           "コケモドキが集まって爆発した時に生まれるレアなコケモドキよ! うおおおお";
            SE_Director.GetComponent<SE_Director>().SE_Kokenamae03();
        }
        name_Show();// 名前と評価アニメ
    }
    public void koke_hakken01() // キノコ
    {
        name_Hide(); // 名前と評価アニメ準備
        rand_koketipe00 = Random.Range(0, 3); // こけたいぷ名らんだむ
        if (rand_koketipe00 == 0)
        {
            hyouka_rand = Random.Range(0, 40); // 評価値ランダム
            this.koke_text.GetComponent<Text>().text =
            "キノコ";
            this.serifu_text.GetComponent<Text>().text =
           "これはただのキノコよ。 あなたのお昼ご飯、何にするか今決めたわ。";
            SE_Director.GetComponent<SE_Director>().SE_Kokenamae02(); // しょぼ
        }
        else if (rand_koketipe00 == 1)
        {
            hyouka_rand = Random.Range(20, 120);
            this.koke_text.GetComponent<Text>().text =
            "キノココケモドキ";
            this.serifu_text.GetComponent<Text>().text =
           "キノコのような見た目のコケモドキね。 キノコと間違えて食べると死ぬわ。";
            SE_Director.GetComponent<SE_Director>().SE_Kokenamae01();// ふつう
        }
        else if (rand_koketipe00 == 2)
        {
            hyouka_rand = Random.Range(200, 310);
            this.koke_text.GetComponent<Text>().text =
            "マリオノメシ";
            this.serifu_text.GetComponent<Text>().text =
           "不思議な名前のコケモドキ、四角い箱型の土から生えるレアモノよ! マンマミヤ!";
            SE_Director.GetComponent<SE_Director>().SE_Kokenamae03(); // レア
        }
        
        name_Show();// 名前と評価アニメ
    }
    public void koke_hakken01_2() // 見にキノコ
    {
        name_Hide(); // 名前と評価アニメ準備
        rand_koketipe00 = Random.Range(0, 3); // こけたいぷ名らんだむ
        if (rand_koketipe00 == 0)
        {
            hyouka_rand = Random.Range(0, 50); // 評価値ランダム
            this.koke_text.GetComponent<Text>().text =
            "ミニキノコ";
            this.serifu_text.GetComponent<Text>().text =
           "小さいキノコを見つけたのね。 ありがとう。 捨てていいわよ。";
            SE_Director.GetComponent<SE_Director>().SE_Kokenamae02();
        }
        else if (rand_koketipe00 == 1)
        {
            hyouka_rand = Random.Range(40, 140);
            this.koke_text.GetComponent<Text>().text =
            "コケキノコ";
            this.serifu_text.GetComponent<Text>().text =
           "厳密にはコケモドキではないけれど、欲しがるコケモドキマニアは多いわ。";
            SE_Director.GetComponent<SE_Director>().SE_Kokenamae01();
        }
        else if (rand_koketipe00 == 2)
        {
            hyouka_rand = Random.Range(188, 310);
            this.koke_text.GetComponent<Text>().text =
            "ドングリノヨコ";
            this.serifu_text.GetComponent<Text>().text =
           "どんぐりの隣にだけ生える激レアのコケモドキよ! なんて目が良いのかしら!";
            SE_Director.GetComponent<SE_Director>().SE_Kokenamae03();
        }
       
        name_Show();// 名前と評価アニメ
    }
    public void koke_hakken02() // ねこ
    {
        name_Hide(); // 名前と評価アニメ準備
        rand_koketipe00 = Random.Range(0, 4); // こけたいぷ名らんだむ
        if (rand_koketipe00 == 0)
        {
            hyouka_rand = Random.Range(220, 282); // 評価値ランダム
            this.koke_text.GetComponent<Text>().text =
            "ネココケモドキ";
            this.serifu_text.GetComponent<Text>().text =
           "ネコのような形をしたコケモドキね。 一般の魔女にも人気があるわ。";
            SE_Director.GetComponent<SE_Director>().SE_Kokenamae01(); // 普通
        }
        else if (rand_koketipe00 == 1)
        {
            hyouka_rand = Random.Range(1, 40);
            this.koke_text.GetComponent<Text>().text =
            "ヌココケモドキ";
            this.serifu_text.GetComponent<Text>().text =
           "ネココケモドキの偽者だわ。 ただのコケモドキが集まっているだけね。";
            SE_Director.GetComponent<SE_Director>().SE_Kokenamae02();// しょぼ
        }
        else if (rand_koketipe00 == 2)
        {
            hyouka_rand = Random.Range(200, 320);
            this.koke_text.GetComponent<Text>().text =
            "イヌデワナインダ";
            this.serifu_text.GetComponent<Text>().text =
           "この主張するような堂々としたスタイル…まさにコケモドキの妙だわ!";
            SE_Director.GetComponent<SE_Director>().SE_Kokenamae03(); // レア
        }
        else if (rand_koketipe00 == 3)
        {
            hyouka_rand = Random.Range(-200, 10);
            this.koke_text.GetComponent<Text>().text =
            "ドラエモドキ";
            this.serifu_text.GetComponent<Text>().text =
           "このコケモドキ…''奇妙''だわッ! なにか奇天烈なものを感じるッ!!";
            SE_Director.GetComponent<SE_Director>().SE_Kokenamae03(); // レア
        }
        //まじでウオオオまじかこれ超レアなこけこけこっここけ
        name_Show();// 名前と評価アニメ
    }


    void name_Hide() // 名前と評価アニメの前準備、評価値計算
    {
        koke_namaeView.Hide(); // 座標をもどす
        koke_imageView.Hide();
        hyouka_View.Hide();
        hyouka_imageView.Hide();
        kakutoku_View.Hide();
        serifu_text_View.Hide();
    }
   void name_Show() // 名前と評価のアニメ
    {
        ranking_oukanImage.SetActive(true); // 王冠ON
        koke_namaeView.Show();
        koke_imageView.Show();
        hyouka_View.Show();
        hyouka_imageView.Show();
        kakutoku_View.Show();
        serifu_text_View.Show();//セリフ右から左
        hyouka_plusrand = Random.Range(1, 200); // 苔発見数に応じたランダムボーナス分
        hyouka_plusrand = hyouka_plusrand * (koke_kaisuu * 0.005f);
        //発見1回目で0.005~1.00プラス、100回で0.5~50プラス
        if (hyouka_plusrand > 100)
        {
            hyouka_plusrand = 100; // MAX100ボーナス
        }// 発見100回で上限
        hyouka_point = hyouka_rand + hyouka_plusrand; // 最終評価値
        hyouka_point = Mathf.FloorToInt(hyouka_point); // 小数点切捨て
        this.hyouka_text.GetComponent<Text>().text =
              "評価:" + this.hyouka_point.ToString("f0");
    }

    public void Sumaho_OnOff() // 右上のスマホボタンで移動とジャンプパネルおんおふ
    {
        if (sumaho_flag == 0)
        {
            Button_R_sumaho.SetActive(true);
            Button_L_sumaho.SetActive(true);
            Button_J_sumaho.SetActive(true);
            sumaho_flag = 1;
        }
        else if(sumaho_flag == 1)
        {
            Button_R_sumaho.SetActive(false);
            Button_L_sumaho.SetActive(false);
            Button_J_sumaho.SetActive(false);
            sumaho_flag = 0;
        }

    }
}




_______

以上になります。

思うところあればブログでもツイッタでも感想をいただけると嬉しいです。超絶天才ハイパージーニアスな書き方だとか、史上最低のゴミ雑巾スクリプトだとか何でも結構です。

基本的にググってコピペという書き方しかしてこなかったので、どこがどういう意味なのかは全然わかりません。書き方のルールなどプログラミングそのものの勉強はゼロです。


ほかにも「プレイヤーの挙動のスクリプトが見たい!」などの声があればそちらも公開しようかなと思います。逆に「まちがった書き方を助長している!けしからん!」みたいな声があれば泣きながら非公開とさせていただきます。

ちなみに全体のスクリプト数は15になりました。スパゲッティ・モンスターコード教としてはかなり少ないほうです。実力がついてきたにちがいない…。


つたないコードを最後まで見てくださってありがとうございました!
ところでプログラムとコードとスクリプトって全部同じ意味な気がする。なんもわからん。あ~あ、早く力らがほしいなあ!




※追記 8/30

今回の記事をunityroomの管理人であるないち様にとりあげていただけました!

他の方の公開プロジェクトもいくつか紹介されているので、こちらにもぜひ目を通していただければと思います!



※追記 9/1

toddlerさんが現在公開されているコードをまとめてくださいました、ありがとうございます!公開してくださった皆さまにも感謝!




おしまい。
 

2 件のコメント:

  1. 新しい知見が増えることを願って
    https://www.slideshare.net/junyashimazu/20140823-refactering

    返信削除
    返信
    1. リンクありがとうございます。
      勉強させていただきます!

      削除