// à revoir en utilisant publishMessage
        public void SendReplay(string sender, string receiver, string fieldName, string fieldValue)
        {
            ReplayMessage msg     = new ReplayMessage(sender, receiver, "content not set", fieldName, fieldValue, DateTime.Now.ToString());
            string        message = MsgSerialization.ToXML(msg);

            connector.Publish(IMQTTConnector.REPLAY_TOPIC, message);
        }
        public void SendGotBoxMsg()
        {
            GamaReponseMessage msg     = new GamaReponseMessage(connector.clientId, "GamaAgent", "Message from Unity", DateTime.Now.ToString());
            string             message = MsgSerialization.ToXML(msg);

            connector.Publish("replay", message);
        }
    public void AgentsGenerator()
    {
        Vector2[] vertices2D = { new Vector2(340.4437f, 739.1506f), new Vector2(350.0437f, 688.6506f), new Vector2(369.9437f, 695.1506f), new Vector2(366.7437f, 712.6506f), new Vector2(374.9437f, 713.9506f), new Vector2(383.5437f, 714.5506f), new Vector2(387.2437f, 714.7506f), new Vector2(387.7437f, 712.6506f), new Vector2(383.7437f, 712.3506f), new Vector2(371.8438f, 708.3506f), new Vector2(373.8438f, 695.3506f), new Vector2(398.5437f, 702.7506f), new Vector2(398.4437f, 705.2506f), new Vector2(406.8438f, 707.4506f), new Vector2(407.3438f, 715.0506f), new Vector2(403.0437f, 754.9506f), new Vector2(390.0437f, 754.8506f), new Vector2(389.8438f, 756.5506f), new Vector2(365.3438f, 752.5506f), new Vector2(363.7437f, 743.0506f), new Vector2(361.1437f, 742.7506f), new Vector2(361.8438f, 745.0506f), new Vector2(339.1437f, 747.0506f) };

        List <GamaPoint> list = new List <GamaPoint>();

        foreach (Vector2 v in vertices2D)
        {
            GamaPoint p = new GamaPoint
            {
                x = v.x,
                y = v.y,
                z = 0
            };
            list.Add(p);
        }

        for (int i = 0; i < 3000; i++)
        {
            UnityAgent unityAgent = new UnityAgent
            {
                unread            = "unread",
                sender            = "sender",
                receivers         = "receivers",
                emissionTimeStamp = 12
            };

            Content contents = new Content
            {
                agentName    = "agent_" + i,
                species      = "UA",
                geometryType = "POLYGON",
                vertices     = list,
                color        = new GamaColor(),
                height       = 0,
                location     = new GamaPoint(0, 0, 0)
            };

            unityAgent.contents = contents;

            string message = MsgSerialization.ToXML(unityAgent);

            Debug.Log("Message is " + message);

            UnityAgent newAgent = (UnityAgent)MsgSerialization.FromXML(message, new UnityAgent());

            Agent gamaAgent = newAgent.GetAgent();

            Debug.Log("Agent created : agent_" + gamaAgent.name);
        }



        //
    }
        public void SendDeleteAction(string name)
        {
            string message = MsgSerialization.ToXML(new LittosimMessage(ILittoSimConcept.GAMA_TOPIC, "GamaMainAgent", 101, name, 0, 0, DateTime.Now.ToString()));

            PublishMessage(message);
        }
        public void ValidateActionList()
        {
            string message = MsgSerialization.ToXML(new LittosimMessage(ILittoSimConcept.GAMA_TOPIC, "GamaMainAgent", 100, 0, 0, DateTime.Now.ToString()));

            PublishMessage(message);
        }
 public string GetSerializedMessage(int idAction, Vector3 position)
 {
     return(MsgSerialization.ToXML(new LittosimMessage(ILittoSimConcept.GAMA_TOPIC, ILittoSimConcept.GAMA_AGENT, idAction, position.x, position.y, DateTime.Now.ToString())));
 }