Interface IRoom
The rooms are where the game takes place. A room can be a room in a house, or an outdoor location, or anything in between. The game can show only one room at a time.This would usually be the room where the player is, though you can change to a different room than the one the player is in if you want. Note: this is different than "Classic" AGS in which the room is explicitly tied to where the player is.
Inherited Members
Namespace: AGS.API
Assembly: AGS.API.dll
Syntax
public interface IRoom : IDisposable, INotifyPropertyChanged
Properties
| Improve this Doc View SourceAreas
A list of areas (or regions) that exist in the room (like areas in the room that the characters can walk in). There are several types of areas and things you can do with them.
Declaration
IAGSBindingList<IArea> Areas { get; }
Property Value
Type | Description |
---|---|
IAGSBindingList<IArea> | The areas. |
See Also
| Improve this Doc View SourceBackground
A background graphic for the room. The background is actually just a regular object so it can be animated or use any of the properties available on regular objects.
Declaration
IObject Background { get; set; }
Property Value
Type | Description |
---|---|
IObject | The background. |
See Also
| Improve this Doc View SourceBackgroundColor
Gets or sets the background color of the room. If null (the default), then the screen will not be cleared with any color before rendering: this is assuming that you'll cover the screen anyway with images.
Declaration
Color? BackgroundColor { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<Color> | The color of the background. |
Edges
Room edges are a convenient way for scripting a room change once a player walks beyond an edge. You can set the 'X' for the left and right edge, and the 'Y' for the top and bottom edge and subscribe to events when the player crosses the edge to change the room.
Declaration
IEdges Edges { get; }
Property Value
Type | Description |
---|---|
IEdges | The edges. |
Events
Each room has specific events which you can subscribe to and code stuff to happen on those events.
Declaration
IRoomEvents Events { get; }
Property Value
Type | Description |
---|---|
IRoomEvents | The events. |
ID
Each rooms should have a unique id (string) which identifies it to the engine.
Declaration
string ID { get; }
Property Value
Type | Description |
---|---|
System.String | The identifier. |
Limits
Gets the room limits (a rectangle defining the room area) The room limits are used to limit the camera from moving too much to the left or to the right. By default the room limits are bound to the room background size and start from (0,0). This can be changed, however, by setting a custom RoomLimitsProvider.
Declaration
RectangleF Limits { get; }
Property Value
Type | Description |
---|---|
RectangleF | The limits. |
MusicOnLoad
An optional music clip you can play when switching to the room. If moved from another room with a music clip, there clips will be cross-faded, and you can configure the cross-fading duration and easing functions from RoomMusicCrossFading.
Declaration
IAudioClip MusicOnLoad { get; set; }
Property Value
Type | Description |
---|---|
IAudioClip | The audio clip. |
Objects
A list of objects that are placed in the room (note that unlike "Classic" AGS, objects can be moved between rooms).
Declaration
IConcurrentHashSet<IObject> Objects { get; }
Property Value
Type | Description |
---|---|
IConcurrentHashSet<IObject> | The objects. |
Properties
Special properties which you can attach to a room which might be useful for special coding tasks.
Declaration
ICustomProperties Properties { get; }
Property Value
Type | Description |
---|---|
ICustomProperties | The properties. |
RoomLimitsProvider
Allows changing the default behavior which defines how the room limits are provided. The room Limits are used to limit the camera from moving too much to the left or to the right. By default the room limits are bound to the room background size and start from (0,0). This can be changed, however, by setting this property to a different room limits provider.
Declaration
IRoomLimitsProvider RoomLimitsProvider { get; set; }
Property Value
Type | Description |
---|---|
IRoomLimitsProvider | The room limits provider. |
Examples
You can use the AGSRoomLimits class, which provides some built in options for room limits:
room.RoomLimitsProvider = AGSRoomLimits.FromBackground; //This is the default option
room.RoomLimitsProvider = AGSRoomLimits.Infinite; //A room "without" limits. The only limits enforced are due to the coordinates supplied in floating points, so the actual limits for the room will be -3.402823e38 - 3.402823e38 (i.e 3402823 + 38 zeroes).
room.RoomLimitsProvider = AGSRoomLimits.Custom(new RectangleF(-50f, 0f, 100f, 200f)); //The room starts at (-50,0) and has a size of (100,200).
|
Improve this Doc
View Source
ShowPlayer
A flag indicating whether the player is to be shown in the room, for hiding the player from a map, for example. This is a convenience flag as this can be achieved by simply switching the room without moving the player to another room.
Declaration
bool ShowPlayer { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Methods
| Improve this Doc View SourceFind<TObject>(String)
Fins a room object with the specified id.
Declaration
TObject Find<TObject>(string id)
where TObject : class, IObject
Parameters
Type | Name | Description |
---|---|---|
System.String | id | Identifier. |
Returns
Type | Description |
---|---|
TObject | The object if found, null otherwise. |
Type Parameters
Name | Description |
---|---|
TObject | The object's type. |
GetMatchingAreas(PointF, String)
Get all room areas that contain the specified point (and apply to the optional specified entity).
Declaration
IEnumerable<IArea> GetMatchingAreas(PointF point, string entityId)
Parameters
Type | Name | Description |
---|---|---|
PointF | point | Point. |
System.String | entityId | Entity identifier. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IArea> | The matching areas. |