public ChannelServer(string ipAddress, int port) : base(ipAddress, port) { gameEngine = new GameEngine(); mapEngine = new MapEngine(ConfigurationManager.ConnectionStrings["XiahDb"].ConnectionString, ConfigurationManager.ConnectionStrings["XiahDb"].ProviderName); accountManager = new AccountManager(ConfigurationManager.ConnectionStrings["XiahDb"].ConnectionString, ConfigurationManager.ConnectionStrings["XiahDb"].ProviderName); characterManager = new CharacterManager(ConfigurationManager.ConnectionStrings["XiahDb"].ConnectionString, ConfigurationManager.ConnectionStrings["XiahDb"].ProviderName); itemDataManager = new ItemDataManager(ConfigurationManager.ConnectionStrings["XiahDb"].ConnectionString, ConfigurationManager.ConnectionStrings["XiahDb"].ProviderName); }
public List <Character> GetCharactersInRange(Position pos, int distance) { List <Character> nearbyChars = ActiveClientEntities.Where(entity => entity is Character && MapEngine.GetDistance(pos.X, pos.Y, entity.Position.X, entity.Position.Y) <= distance).Cast <Character>().ToList(); return(nearbyChars); }
private void InitiateMapEngines() { Map[] maps = mapManager.GetAllMaps(); mapEngines = new List<MapEngine>(); for (int i = 0; i < maps.Length; i++) { MapEngine mapEngine = new MapEngine(ConfigurationManager.ConnectionStrings["XiahDb"].ConnectionString, ConfigurationManager.ConnectionStrings["XiahDb"].ProviderName, maps[i]); mapEngine.MonsterMove += new EventHandler<MonsterMoveInfoEventArgs>(mapEngine_MonsterMove); mapEngine.MonsterAttack += new EventHandler<MonsterAttackInfoEventArgs>(mapEngine_MonsterAttack); mapEngines.Add(mapEngine); } }