Class TellPeopleToLeaveRoomAction
An action that causes the current PersonLike to tell everyone else who is currently in the room to leave it. When initializing this action, a set of ExcludedPeople can optionally be specified.
public class TellPeopleToLeaveRoomAction : Action, IGenericDataHolder
- Inheritance
-
JsonTypeSafeGenericDataHolderTellPeopleToLeaveRoomAction
- Implements
-
IGenericDataHolder
- Inherited Members
-
JsonTypeSafeGenericDataHolder.GetDataKeys()
- Extension Methods
Constructors
TellPeopleToLeaveRoomAction(ActionInfo, params Guid[])
public TellPeopleToLeaveRoomAction(ActionInfo info, params Guid[] excludedPeople)
Parameters
info
ActionInfoexcludedPeople
Guid[]
Fields
ExcludedPeople
A list of Guid ids of PersonLike objects that should not be asked to leave the room
[DataMember]
public readonly Guid[] ExcludedPeople
Field Value
- Guid[]
Methods
Initialize()
This method is called when the action is first started by a Person. Note that it is not called when the action gets added to the ActionQueue, but when it is moved to CurrentActions.
public override void Initialize()
IsCompleted()
This method is called every update frame by a Person if this action is currently active to check if it should be stopped. If this returns a result other than Completed, OnCompleted(CompletionType) will be called and the action is stopped. By default, only ForceResult modifies the completion type, otherwise Active is returned.
public override CompletionType IsCompleted()
Returns
- CompletionType
The current completion type of this action
OnCompleted(CompletionType)
This method is called when this action IsCompleted(), or if it is canceled from an outside source. Note that, if this method is called as a result of IsCompleted(), the CompletionType passed will be the same. By default, only OnActionCompleted(Action, CompletionType, bool) is called.
public override void OnCompleted(CompletionType type)
Parameters
type
CompletionTypeThe type that this action completed with
TryToLeaveRoom(Room, PersonLike)
Causes the given person to try to leave the current room, which is expected to be the room they are in. This method enqueues a GoHere action for a random location in an adjacent, connected room (GetConnectedRooms(PersonLike)).
public static bool TryToLeaveRoom(Room currentRoom, PersonLike person)
Parameters
currentRoom
RoomThe room to leave
person
PersonLikeThe person that should leave the room
Returns
- bool
false if there are no connected rooms to the given
currentRoom
, true otherwise