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);
        }
 //        protected int milliseconds;
 public Move(Character.MovementDirection _direction, Character _charToMove)
     : base(Type.Move)
 {
     direction = _direction;
     charToMove = _charToMove;
     //			milliseconds = _milliseconds;
 }
 // TODO: get real values
 public Weapon(WeaponInfo.Type _type)
     : base(null, new Vector2(1,1))
 {
     owner = null;
     info = Constants.Instance.getWeaponInfo(_type);
     lastShotTime = 0;
     ammoLeft = info.magSize;
 }
 /// <summary>
 /// Assigns this weapon to a character
 /// <param name="c">The character to set as owner</param>
 /// </summary>
 public void setOwner(Character c)
 {
     owner = c;
 }
 public LightCharacter(Character c)
 {
     textureName = c.getTextureName();
     position = c.body.position;
     size = c.getSize();
 }
 public Shoot(Character _shooter, int _time)
     : base(Type.Shoot)
 {
     shooter = _shooter;
     time = _time;
 }
        public void setEnvironment(LightEnvironment env)
        {
            Player local = new Player("Georges"); // TODO : change this

            environment = GameEnvironment.Instance;
            environment.init(env.map, local);

            pengine = new PhysicsEngine(environment.Map);

            //Character character = new Character("patate", pengine, new Vector2(150, 300), new Vector2(50, 50));
            Character character = new Character("swattds", pengine, new Vector2(150, 300), new Vector2(75, 75), 55);
            local.addCharacter(character);

            foreach (LightPlayer lp in env.players)
            {
                Player p = new Player(lp.name);
                Character c = new Character(lp.character.textureName, pengine, lp.character.position, lp.character.size, lp.character.size.X);
                p.addCharacter(c);
                environment.AddPlayer(p);
            }

            // Sending local info to server
            communication.SendReliable(new LightPlayer(local), NetFrame.FrameType.player);

            ready = true;
        }
 public void setFollowedCharacter(Character character)
 {
     // set the character as the new followed object
     followedCharacter = character;
     // Centers view on the character
     cameraPosition = -character.getPosition();
     cameraPosition.X += graphics.PreferredBackBufferWidth / 2;
     cameraPosition.Y += graphics.PreferredBackBufferHeight / 2;
 }
 public Reload(Character _reloader)
     : base(Type.Reload)
 {
     reloader = _reloader;
 }
 public Player AddPlayer(LightPlayer lp)
 {
     Player p = new Player(lp.name);
     Character c = new Character(lp.character.textureName, pengine, lp.character.position, lp.character.size, lp.character.size.X);
     p.addCharacter(c);
     newPlayers.Enqueue(p);
     return p;
 }