所以我正在一步一步制作一个基本的Zork控制台应用游戏。每次门都是随机的(尚未完成),玩家必须猜测要通过哪扇门,只有一个允许通过。然而,为了让用户输入更快,我想用倒数计时器给墙壁关闭它们的错觉,如果他们在达到零之前没有输入任何内容,他们将被“杀死”,但我不知道如何添加倒数计时器,但也让控制台检查用户关于移动的输入。这是我当前的代码,请记住它还没有完成。
using System;
using System.Threading;
namespace Prog4
{
class program
{
public static void Main(string[] args)
{
Random random = new Random();
int north = random.Next(1,5);
int south = random.Next(1,5);
int east = random.Next(1,5);
int west = random.Next(1,5);
Console.WriteLine("You are in a room that is slowly closing in on you, it has only four exits." + Environment.NewLine +
"The four exits face: North, South, East and West. " + Environment.NewLine +
"Use n for North, s for South, e for East and w for West" + Environment.NewLine +
"Only one exit leads to outside, the rest lead to certain doooooooooooooom");
}
}
}