\u5404\u30de\u30b9\u306e\u72b6\u614b\u306f\u3001\u843d\u4e0b\u30d6\u30ed\u30c3\u30af\u300c2\u300d\u3001\u58c1\u30d6\u30ed\u30c3\u30af\u300c1\u300d\u3001\u914d\u7f6e\u30d6\u30ed\u30c3\u30af\u300c3\u300d\u3068\u5b9a\u7fa9\u3057\u307e\u3057\u305f\u3002\u305d\u306e\u305f\u3081\u3001\u843d\u4e0b\u30d6\u30ed\u30c3\u30af\u300c2\u300d\u306e1\u30de\u30b9\u4e0b\u304c\u58c1\u30d6\u30ed\u30c3\u30af\u300c1\u300d\u307e\u305f\u306f\u914d\u7f6e\u30d6\u30ed\u30c3\u30af\u300c3\u300d\u3067\u3042\u308c\u3070\u3001\u7740\u5730\u3068\u5224\u5b9a\u3055\u305b\u307e\u3059\u3002<\/p>\n\n\n\n
\u4e0b\u306ejudgeGround\u30e1\u30bd\u30c3\u30c9\u304c\u843d\u4e0b\u30d6\u30ed\u30c3\u30af\u306e\u7740\u5730\u5224\u5b9a\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n
public bool judgeGround(int blockNum, int rot, int[,] blockStat, int x, int y){\n bool groundFlg = false; \n int[,] block = new int[4,4];\n block = fallBlockSet.set(blockNum, rot);\n for(int i=0; i<4; i++){\n for(int j=3; j>=0; j--){\n if(block[j,i] == 2){\n if(blockStat[y + j + 1, x + i] == 1 || blockStat[y + j + 1, x + i] == 3){\n groundFlg = true;\n break;\n }\n }\n }\n }\n return groundFlg;\n}<\/code><\/pre><\/div>\n\n\n\n\u843d\u4e0b\u30d6\u30ed\u30c3\u30af\u306e\u5074\u9762\u5f53\u305f\u308a\u5224\u5b9a<\/h2>\n\n\n\n \u843d\u4e0b\u30d6\u30ed\u30c3\u30af\u306e\u5074\u9762\u5f53\u305f\u308a\u5224\u5b9a\u306f\u3001\u7740\u5730\u5224\u5b9a\u3068\u540c\u69d8\u3001 \u843d\u4e0b\u30d6\u30ed\u30c3\u30af\u306e1\u30de\u30b9\u53f3\u307e\u305f\u306f\u5de6\u304c\u58c1\u30d6\u30ed\u30c3\u30af\u307e\u305f\u306f\u914d\u7f6e\u30d6\u30ed\u30c3\u30af\u306e\u5834\u5408\u306b\u5224\u5b9a\u3059\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002 <\/p>\n\n\n\n <\/figure>\n\n\n\n \u4e0b\u306ejudgeContactRight\u30e1\u30bd\u30c3\u30c9\u304c\u843d\u4e0b\u30d6\u30ed\u30c3\u30af\u306e\u53f3\u5074\u9762\u5f53\u305f\u308a\u5224\u5b9a\u3001judgeContactLeft\u30e1\u30bd\u30c3\u30c9\u304c\u5de6\u5074\u9762\u5f53\u305f\u308a\u5224\u5b9a\u306b\u306a\u308a\u307e\u3059\u3002 <\/p>\n\n\n\n
public bool judgeContactRight(int blockNum, int rot, int[,] blockStat, int x, int y){\n bool contactFlg = false; \n int[,] block = new int[4,4];\n block = fallBlockSet.set(blockNum, rot);\n for(int j=0; j<4; j++){\n for(int i=3; i>=0; i--){\n if(block[j,i] == 2){\n if(blockStat[y + j, x + i + 1] == 1 || blockStat[y + j, x + i + 1] == 3){\n contactFlg = true;\n break;\n }\n }\n }\n }\n return contactFlg;\n}\npublic bool judgeContactLeft(int blockNum, int rot, int[,] blockStat, int x, int y){\n bool contactFlg = false; \n int[,] block = new int[4,4];\n block = fallBlockSet.set(blockNum, rot);\n for(int j=0; j<4; j++){\n for(int i=0; i<4; i++){\n if(block[j,i] == 2){\n if(blockStat[y + j, x + i - 1] == 1 || blockStat[y + j, x + i - 1] == 3){\n contactFlg = true;\n break;\n }\n }\n }\n }\n return contactFlg;\n}<\/code><\/pre><\/div>\n\n\n\n \u843d\u4e0b\u30d6\u30ed\u30c3\u30af\u304c\u7740\u5730\u3057\u305f\u3089\u3001\u4e00\u5b9a\u6642\u9593\u7d4c\u904e\u5f8c\u306b\u6b21\u306e\u843d\u4e0b\u30d6\u30ed\u30c3\u30af\u3092\u843d\u3068\u3059<\/h2>\n\n\n\n \u843d\u4e0b\u30d6\u30ed\u30c3\u30af\u306e\u7740\u5730\u5224\u5b9a\u30d7\u30ed\u30b0\u30e9\u30e0\u304c\u5b8c\u6210\u3057\u305f\u306e\u3067\u3001\u7740\u5730\u5224\u5b9a\u3057\u305f\u3089\u4e00\u5b9a\u6642\u9593\u7d4c\u904e\u5f8c\u306b\u6b21\u306e\u843d\u4e0b\u30d6\u30ed\u30c3\u30af\u3092\u843d\u3068\u3059\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4f5c\u6210\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n\n\n\n
\u4f01\u753b\u7de8\u3067\u30b2\u30fc\u30e0\u306e\u72b6\u614b\u9077\u79fb\u3092\u8a2d\u8a08\u3057\u307e\u3057\u305f\u3002<\/p>\n\n\n\n <\/figure>\n\n\n\n\u3053\u308c\u306b\u5247\u3063\u3066\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u66f8\u3044\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n
\u4e0b\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u304c \u843d\u4e0b\u30d6\u30ed\u30c3\u30af\u304c\u7740\u5730\u5224\u5b9a\u3057\u305f\u3089\u4e00\u5b9a\u6642\u9593\u6bce\u306b\u843d\u4e0b\u30d6\u30ed\u30c3\u30af\u3092\u843d\u3068\u3059\u30d7\u30ed\u30b0\u30e9\u30e0\u3067\u3059\u3002GameController\u30b9\u30af\u30ea\u30d7\u30c8\u306eStart\u30e1\u30bd\u30c3\u30c9\u3001Update\u30e1\u30bd\u30c3\u30c9\u306b\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002\u65e2\u306b\u8aac\u660e\u3057\u305f\u5185\u5bb9\u306b\u3064\u3044\u3066\u306f\u7701\u7565\u3057\u3066\u3044\u307e\u3059\u306e\u3067\u3001 \u3054\u4e86\u627f\u3092\u3002<\/p>\n\n\n\n
private int gameStat; \/\/ \u30b2\u30fc\u30e0\u30b9\u30c6\u30fc\u30bf\u30b9\nprivate const int GAMEOVER = 0;\nprivate const int START = 1;\nprivate const int GROUND = 2;\nprivate const int ERASE = 3;\nprivate bool downIhbFlg; \/\/ 0:\u4e0b\u79fb\u52d5\u8a31\u53ef\u30011:\u4e0b\u79fb\u52d5\u7981\u6b62\nprivate float fallCountTime; \/\/ \u843d\u4e0b\u30d6\u30ed\u30c3\u30af\u304c1\u30de\u30b9\u843d\u4e0b\u3057\u3066\u304b\u3089\u306e\u7d4c\u904e\u6642\u9593\nprivate float groundCountTime; \/\/ \u843d\u4e0b\u30d6\u30ed\u30c3\u30af\u304c\u7740\u5730\u3057\u3066\u304b\u3089\u306e\u7d4c\u904e\u6642\u9593\n\/*\n... (\u7701\u7565)\n*\/\nvoid Start()\n{\n gameStat = START;\n fallCountTime = 0;\n groundCountTime = 0;\n downIhbFlg = false;\n\u3000\u3000\/*\n ... (\u7701\u7565)\n *\/\n}\nvoid Update()\n{ \n switch(gameStat){\n case START:\n downIhbFlg = false;\n \/\/ \u843d\u4e0b\u30d6\u30ed\u30c3\u30af\u30921\u79d2\u6bce\u306b\u843d\u4e0b\n fallCountTime += Time.deltaTime;\n if(fallCountTime >= 1){\n fallBlockPosY++;\n fallCountTime = 0;\n }\n \/\/ \u843d\u4e0b\u30d6\u30ed\u30c3\u30af\u306e\u7740\u5730\u5224\u5b9a\n if(judgeGround(blockNum, rot, blockStat, fallBlockPosX, fallBlockPosY) == true){\n gameStat = GROUND;\n }\n break;\n case GROUND:\n fallCountTime = 0;\n groundCountTime += Time.deltaTime;\n downIhbFlg = true;\n \/\/ \u843d\u4e0b\u30d6\u30ed\u30c3\u30af\u306e\u975e\u7740\u5730\u5224\u5b9a\n if(judgeGround(blockNum, rot, blockStat, fallBlockPosX, fallBlockPosY) == false){ \n groundCountTime = 0;\n gameStat = START;\n }\n if(groundCountTime >= 1){\n fallBlockPosX = fallBlockInitPosX;\n fallBlockPosY = fallBlockInitPosY;\n blockNum = Random.Range(0, 8);\n rot = 0;\n fallBlockStat = fallBlockSet.set(blockNum, rot);\n gameStat = START;\n groundCountTime = 0;\n }\n break;\n case ERASE:\n break;\n \n case GAMEOVER:\n break;\n }\n \/\/ \u4e0b\u30ad\u30fc or S\u30ad\u30fc\u3092\u62bc\u3057\u305f\u3068\u304d\u843d\u4e0b\u30d6\u30ed\u30c3\u30af\u30921\u30de\u30b9\u4e0b\u306b\u79fb\u52d5\n if(Input.GetButtonDown("Vertical") == true && downIhbFlg == false){\n if(Input.GetAxis("Vertical") < -0.01f)\n {\n fallBlockPosY++; \n fallCountTime = 0;\n }\n }\n}<\/code><\/pre><\/div>\n\n\n\n\u30b2\u30fc\u30e0\u304c\u958b\u59cb\u3057\u305f\u3089\u3001\u30b2\u30fc\u30e0\u30b9\u30c6\u30fc\u30bf\u30b9\u3092”START”\u306b\u3057\u307e\u3059\u3002”START”\u3067\u306f\u3001\u843d\u4e0b\u30d6\u30ed\u30c3\u30af\u306e\u7740\u5730\u5224\u5b9a\u3092\u884c\u3044\u3001\u5224\u5b9a\u3057\u305f\u3089\u4e00\u5b9a\u6642\u9593\u5f8c\u306b\u30b2\u30fc\u30e0\u30b9\u30c6\u30fc\u30bf\u30b9\u3092”GROUND”\u306b\u9077\u79fb\u3055\u305b\u307e\u3059\u3002”GROUND”\u3067\u306f\u3001\u7740\u5730\u6642\u9593\u3092\u8a08\u6e2c\u3057\u3001\u4e00\u5b9a\u6642\u9593\u7d4c\u904e\u3057\u305f\u3089\u6b21\u306e\u843d\u4e0b\u30d6\u30ed\u30c3\u30af\u3092\u8868\u793a\u3055\u305b\u3001”START”\u72b6\u614b\u306b\u623b\u3057\u307e\u3059\u3002\u3082\u3057\u30d7\u30ec\u30a4\u30e4\u30fc\u304c\u843d\u4e0b\u30d6\u30ed\u30c3\u30af\u3092\u5de6\u53f3\u306b\u79fb\u52d5\u3055\u305b\u3001\u7740\u5730\u5224\u5b9a\u304b\u3089\u629c\u3051\u305f\u3089\u4f55\u3082\u305b\u305a”START”\u72b6\u614b\u306b\u623b\u3057\u307e\u3059\u3002<\/p>\n\n\n\n
\u843d\u4e0b\u30d6\u30ed\u30c3\u30af\u5074\u9762\u5f53\u305f\u308a\u3057\u305f\u3089\u3001\u843d\u4e0b\u30d6\u30ed\u30c3\u30af\u306e\u6a2a\u79fb\u52d5\u3092\u62d8\u675f\u3059\u308b <\/h2>\n\n\n\n \u843d\u4e0b\u30d6\u30ed\u30c3\u30af\u306e\u5074\u9762\u5f53\u305f\u308a\u5224\u5b9a\u3092\u4f7f\u3063\u3066\u3001\u843d\u4e0b\u30d6\u30ed\u30c3\u30af\u306e\u6a2a\u79fb\u52d5\u3092\u62d8\u675f\u3059\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4f5c\u3063\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n\n\n\n
if(Input.GetButtonDown("Horizontal") == true)\n{\n \/\/ \u53f3\u30ad\u30fc or D\u30ad\u30fc\u3092\u62bc\u3057\u305f\u3068\u304d\u843d\u4e0b\u30d6\u30ed\u30c3\u30af\u30921\u30de\u30b9\u53f3\u306b\u79fb\u52d5\n if(Input.GetAxis("Horizontal") > 0.01f && judgeContactRight(blockNum, rot, blockStat, fallBlockPosX, fallBlockPosY) == false)\n {\n fallBlockPosX++; \n }\n \/\/ \u5de6\u30ad\u30fc or A\u30ad\u30fc\u3092\u62bc\u3057\u305f\u3068\u304d\u843d\u4e0b\u30d6\u30ed\u30c3\u30af\u30921\u30de\u30b9\u5de6\u306b\u79fb\u52d5\n if(Input.GetAxis("Horizontal") < -0.01f && judgeContactLeft(blockNum, rot, blockStat, fallBlockPosX, fallBlockPosY) == false)\n {\n fallBlockPosX--;\n }\n}<\/code><\/pre><\/div>\n\n\n\n\u30ad\u30fc\u5165\u529b\u3067\u5de6\u53f3\u79fb\u52d5\u3059\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u306f\u65e2\u306b\u4f5c\u6210\u6e08\u3067\u3059\u306e\u3067\u3001\u30ad\u30fc\u64cd\u4f5c\u5224\u5b9a\u5185\u306b\u5074\u9762\u5f53\u305f\u308a\u5224\u5b9a\u3092\u8ffd\u52a0\u3059\u308b\u3053\u3068\u3067\u843d\u4e0b\u30d6\u30ed\u30c3\u30af\u306e\u6a2a\u79fb\u52d5\u3092\u62d8\u675f\u3055\u305b\u307e\u3057\u305f\u3002<\/p>\n\n\n\n