public async Task CharacterArrives(Character CharacterObject) { CharacterObject.CurrentXYZ = StorageID; Occupants.Add(new Occupant() { DisplayName = CharacterObject.DisplayName, StorageID = CharacterObject.StorageID }); LastVisited = DateTime.Now; LastVisitedBy = CharacterObject.Name; var soul = CharacterObject.ConvertToSoul(); var nearbyPlayers = GetNearbyPlayers(); var request = JSON.Encode(new { Category = "Events", Type = "CharacterArrives", Soul = soul }); foreach (var player in nearbyPlayers) { await player.SendString(request); } foreach (var occupant in Occupants) { Storage.Current.NPCs.Find(occupant.StorageID)?.CheckAwareness(CharacterObject); } }
public void Occupy(Token TknOccupant) { Occupants.Add(TknOccupant); TknOccupant.TokenPosition = this.fieldId; if (IsOccupied == true && Occupants.Count > 1) { KillEnemy(); } }
public void AddEntity(Entity entity) { if (entity.Cell != null) { entity.Cell.RemoveEntity(entity); } entity.Cell = this; Occupants.Add(entity); }
public void Arrive(Player player) { if (player.Digit != -1) { // This player is not bankrupt, so they can be added to this tile without problem. Occupants.Add(player); // We've landed on this tile! // Call that abstract void that child classes will implement later. Land(player); OnPropertyChanged("Occupants"); } }
/// <summary> /// Adds the character. /// </summary> /// <param name="character">The character.</param> /// <param name="entryDirection">The entry direction.</param> public virtual void AddCharacter(IMob character, AvailableTravelDirections entryDirection) { if (Occupants.Contains(character)) { return; } else { Occupants.Add(character); OnEnterEvent(character, entryDirection); } }
public Tuple <bool, string> AddClient(Client _client) { if (Occupants?.Count < MaxOccupancy) { Occupants?.Add(_client); return(Tuple.Create(true, $"Client with ID : {_client.ClientId} was added to Room with RoomId : {RoomId}")); } if ((bool)Occupants?.Any(occupant => occupant.IsInitiator) && _client.IsInitiator) { Occupants?.Add(_client); return(Tuple.Create(true, $"Client with ID : {_client.ClientId} was added to Room with RoomId : {RoomId} as a participant.")); } return(Tuple.Create(false, $"The Room with ID : {RoomId} has reached MAXIMUM Occupancy of {MaxOccupancy}")); }
public Tuple <bool, string> UpdateClient(Client _client) { var isOccupant = IsClientAnOccupant(_client); if (isOccupant.Item1) { var removedCount = (int)Occupants?.RemoveAll(client => client.ClientId == _client.ClientId); if (removedCount > 0) { Occupants.Add(_client); return(Tuple.Create(true, $"Client with ID: {_client.ClientId} was updated")); } return(Tuple.Create(false, $"Client with ID: {_client.ClientId} was not updated")); } return(isOccupant); }