0
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

初心者Unity:bool型を使ったゲームフラグ管理もどき(備忘録)

Last updated at Posted at 2017-02-17

超初心者投稿。
Boolをはじめていじってて偶然うまくいったのを忘れないように保管。

bool[] stayflg = new bool[5];

void Start() {
    for(int i = 0; i < 5; i++) { stayflg[i] = false; }
}

void Update () {

    if (Input.GetKeyDown(KeyCode.Space) && !stayflg[0]){
        stayflg[0] = true;
    }

    if (stayflg[0]){・・・以下略

このnew boolというのを忘れていた(知らなかった)らしく。
勘で入力していたらうまくいった。

今後このBool配列は二次配列にして、RPGとかアドベンチャーとかのゲームフラグ管理で役に立つかもしれんぬ。

もっといいやり方があるかもしれんけど、それは追々考えよう。

0
4
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?