小编Luk*_*der的帖子

只需检查多个语句C#

目前正在开发一款小型控制台游戏,并且想知道是否有人有简单的方法来缩短这样的事情:

if (map[playerX - 1, playerY] == "R1"
 || map[playerX - 1, playerY] == "R2"
 || map[playerX - 1, playerY] == "R3"
 || map[playerX - 1, playerY] == "Z1" 
 || map[playerX - 1, playerY] == "Z2" 
 || map[playerX - 1, playerY] == "Z3"
 || map[playerX - 1, playerY] == "S1 " 
 || map[playerX - 1, playerY] == "S2" 
 || map[playerX - 1, playerY] == "S3")
Run Code Online (Sandbox Code Playgroud)

制作一个列表或某物,并检查是否map[playerX-1, playerY]等于其中的任何对象或其他东西.

我在这里先向您的帮助表示感谢.Lukas Leder

c# arrays if-statement

1
推荐指数
1
解决办法
91
查看次数

标签 统计

arrays ×1

c# ×1

if-statement ×1