Esempio n. 1
0
    // this is called at program start
    public static void BigBang()
    {
        // create rooms
        Root    root    = new Root();
        Windows windows = new Windows();
        Temp    temp    = new Temp();

        // link them
        root.Windows = windows;
        root.Temp    = temp;
        windows.Root = root;
        temp.Root    = root;

        // now enter the start room
        Enter(root);

        // and run the world
        while (TheUniverseIsAlive)
        {
            string key = Console.ReadKey().Key.ToString().ToUpper();
            Console.WriteLine();
            char c = key[0];
            if (!CurrentRoom.KeyboardOverride(c))
            {
                switch (key[0])
                {
                case 'N':
                    CurrentRoom.OnNorth();
                    break;

                case 'S':
                    CurrentRoom.OnSouth();
                    break;

                case 'W':
                    CurrentRoom.OnWest();
                    break;

                case 'E':
                    CurrentRoom.OnEast();
                    break;

                default:
                    Info("I don't understand you.");
                    break;
                }
            }
        }
    }