From the course: Object-Oriented Programming with C#
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Creating rooms - C# Tutorial
From the course: Object-Oriented Programming with C#
Creating rooms
- [Instructor] So now that we have our house, a room, and our go action, we need a way of telling the house to create the rooms that go inside of it. We're going to build a grid of rooms based on the width and height of the house. This will take the form of a node structure where each room is connected to its neighbor. That's how we'll be able to traverse them when using the Go command. The create room function we're about to add will handle building the grid and connecting each of the rooms together. Let's get started by creating a new partial class called house.room.cs. (computer keyboard clicking) Now that we've added the name space, let's go ahead and create our partial class. Let's go ahead and add our first method. I mentioned earlier that all the rooms are going to be kept in a one dimensional array, but we need to look at the house based on its columns and rows, or its width and its height. In order to match…