Ejemplo n.º 1
0
        /// <summary>
        /// Creates a new Room object.
        /// </summary>
        /// <param name="roomName">The name of the room that is to be created.</param>
        /// <param name="content">The content manager to use for assets.</param>
        /// <param name="doorIndex">The index of the door to enter from.  If no index is specified, or the index is -1,
        /// the room's default spawn location will be used.</param>
        public Room(String name, int doorIndex)
        {
            roomName = name;
            Content = new ContentManager(GameResources.GameServices, "Content");
            soundEngine = new AudioEngine(Content, roomName);

            isLoaded = false;

            Load("Data/Rooms/" + roomName + ".txt", doorIndex);

            if (isPersistant)
                LoadRoomState();

            collisionMap = Content.Load<Texture2D>("Images/" + graphicsName + "Collisions");
            collisionColors = new Color[collisionMap.Width * collisionMap.Height];
            collisionMap.GetData<Color>(collisionColors);
            background = new GameObject(graphicsName, Content);
            background.Spawn(new Vector2(0, 0));
            if (hasLighting)
            {
                lightingMap = new GameObject(graphicsName + "LightingMap", Content);
                lightingMap.Spawn(new Vector2(0, 0));
            }
        }