public ServerEngine(int serverPort, int maxClients/*map name, etc*/) { // Server creation elapsedTime = 0; commands = new ConcurrentQueue<Command.Command>(); updatedPositions = new ConcurrentQueue<KeyValuePair<Player, Position>>(); newPlayers = new ConcurrentQueue<Player>(); communication = new ENetServer(serverPort, maxClients, this); communication.Launch(); // Environment initialization //XMLReader xmlTest = new XMLReader("../../../map_official.xml"); XMLReader xmlTest = new XMLReader("xml/map.xml"); Constants.Instance.init(); Map map = new Map(xmlTest.upperLeft, xmlTest.lowerRight, xmlTest.listObstacle, xmlTest.listWall); Player player = new Player("Champ"); environment = GameEnvironment.Instance; environment.init(map, player); pengine = new PhysicsEngine(environment.Map); Character character = new Character("swattds", pengine, new Vector2(200, 100), new Vector2(75, 75), 55); //Character redshirt = new Character("Redshirt", pengine, new Vector2(400, 100), new Vector2(100, 100)); player.addCharacter(character); //player.addCharacter(redshirt); }
public LightEnvironment(GameEnvironment ge) { map = ge.Map; players = new List<LightPlayer>(); foreach (Player p in ge.Players) { players.Add(new LightPlayer(p)); } }
public static void Draw(Map map, GraphicsEngine graphicEngine) { List<Wall> walls = map.getWalls(); List<Obstacle> obstacles = map.getObstacles(); foreach (Wall w in walls) { //graphicEngine.AddCompletePolygon(w.polyline, Color.LightBlue); //graphicEngine.AddPolyline(w.polyline, Color.Blue); var wallColor = Color.DarkSlateGray; //var wallColor = Color.DarkGray; graphicEngine.AddPolyline(w.polyline, wallColor); graphicEngine.AddCompletePolygon(w.polyline, wallColor); // Color.DarkSlateGray } foreach (Obstacle o in obstacles) { /* graphicEngine.AddCompletePolygon(o.polyline, Color.PaleVioletRed); graphicEngine.AddPolyline(o.polyline, Color.Red);*/ graphicEngine.AddCompletePolygon(o.polyline, Color.SlateGray); } }
public void init(Map.Map _map, Player _localPlayer) { players = new List<Player>(); map = _map; localPlayer = _localPlayer; players.Add(localPlayer); }
public PhysicsEngine(Map.Map m) { map = m; }
public void setMap(Map _map) { map = _map; }