public RoyalGameModel(int gamersInRoom) { //инициализируем полей Players = new List <IPlayer>(); gameObjects = new Dictionary <ulong, IGameObject>(); outgoingMessages = new ObservableQueue <IMessage>(); incomingMessages = new ObservableQueue <IMessage>(); AABB frameField = new AABB(); frameField.LowerBound.Set(0, 0); frameField.UpperBound.Set(LengthOfSideMap, LengthOfSideMap); Field = new World(frameField, new Vec2(0, 0), false); var solver = new RoomContactListener(); Field.SetContactListener(solver); CreateFrame(); DeathZone = BuilderGameObject.CreateDeathZone(this, LengthOfSideMap); //создание и добавление в GameObjects и Field статических объектов карты List <RectangleF> occupiedArea = new List <RectangleF>(); CreateDinamicGameObject(occupiedArea); CreatePlayers(gamersInRoom, occupiedArea); handlerIncomingMessages = new Task(Handler_IncomingMessages); handlerIncomingMessages.Start(); }
/// <summary> /// только для тестов /// </summary> public RoyalGameModel() { //инициализируем полей Players = new List <IPlayer>(); gameObjects = new Dictionary <ulong, IGameObject>(); outgoingMessages = new ObservableQueue <IMessage>(); incomingMessages = new ObservableQueue <IMessage>(); AABB frameField = new AABB(); frameField.LowerBound.Set(0, 0); frameField.UpperBound.Set(LengthOfSideMap, LengthOfSideMap); Field = new World(frameField, new Vec2(0, 0), false); var solver = new RoomContactListener(); Field.SetContactListener(solver); CreateFrame(); DeathZone = BuilderGameObject.CreateDeathZone(this, LengthOfSideMap); handlerIncomingMessages = new Task(Handler_IncomingMessages); handlerIncomingMessages.Start(); }