Esempio n. 1
0
 public AreaSyncData GetAreaSyncData(string areaId)
 {
     return(new AreaSyncData()
     {
         Area = AreaCollection.FindById(areaId),
         Characters = CharacterCollection.FindCharacterOnArea(areaId),
         Sections = SectionCollection.FindAllSectionsByArea(areaId)
     });
 }
Esempio n. 2
0
        public void MovePlayerToArea(string characterId, string destinationAreaId)
        {
            logService.Log($"Moving character on the game state: {characterId}");

            // Find Objects
            var character = CharacterCollection.FindById(characterId);
            var player    = PlayerCollection.FindByPlayerName(character.PlayerName);
            var area      = AreaCollection.FindById(destinationAreaId);

            // Manage area groups of hub service
            hubService.RemovePlayerFromAreaGroup(player.ConnectionId, character?.AreaId);
            hubService.AddPlayerToAreaGroup(player.ConnectionId, destinationAreaId);

            // Change variables
            character.CharacterAreaPosition = area.Position;
            character.AreaId         = area.Id;
            character.AreaName       = area.Name;
            character.movementStatus = CharacterMovementStatus.InPlace;
        }