Interface IHasRoomComponent
This component associates an entity with the game's room system. It means that the entity can be belong to a room and moved between rooms.
Inherited Members
Namespace: AGS.API
Assembly: AGS.API.dll
Syntax
public interface IHasRoomComponent : IComponent, IDisposable, INotifyPropertyChanged
Properties
| Improve this Doc View SourceOnRoomChanged
An event which fires whenever the room is changed.
Declaration
IBlockingEvent OnRoomChanged { get; }
Property Value
Type | Description |
---|---|
IBlockingEvent | The on room changed event. |
PreviousRoom
The previous room that the entity used to reside in until it moved to the current room. This will be null if the entity has never moved rooms.
Declaration
IRoom PreviousRoom { get; }
Property Value
Type | Description |
---|---|
IRoom |
Room
The current room that the entity resides in. If this is entity is to be rendered to the screen it will only be rendered if it's in the same room as the player (or if it's in the UI).
Declaration
IRoom Room { get; }
Property Value
Type | Description |
---|---|
IRoom |
Methods
| Improve this Doc View SourceChangeRoomAsync(IRoom, Nullable<Single>, Nullable<Single>)
Move the entity to a new room. If the entity that's moved to a new room is the player, the new room will be the one shown on the screen.
Declaration
Task ChangeRoomAsync(IRoom room, float? x = default(float? ), float? y = default(float? ))
Parameters
Type | Name | Description |
---|---|---|
IRoom | room | The room to move to. |
System.Nullable<System.Single> | x | An optional x co-ordinate for the entity to move inside the new room. |
System.Nullable<System.Single> | y | An optional y co-ordinate for the entity to move inside the new room. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Examples
private async Task onDoorHotspotClicked()
{
await cPlayer.SayAsync("Ok, time to get inside the house.");
await cPlayer.ChangeRoomAsync(rHouse, 120, 100); //Will move the player to the house (to co-ordinates: 120,100).
}