/// <summary>
        /// handle the message
        /// </summary>
        /// <param name="mes"></param>
        public void HandleMessage(Message mes)
        {
            if (mes.SenderType == PloobsEngine.MessageSystem.SenderType.EVENT && mes.Tag == "TriggerEvent")
            {
                PhysxTrigger trigger = (PhysxTrigger)mes.Content;
                mesRec = mes;

                ////HERE, or anywhere you can handle a message you handle the trigger =P !!!!!!!!!!!
            }
        }        
 /// <summary>
 /// Chamado qd uma mensagem chega
 /// Handle message
 /// </summary>
 /// <param name="Reciever"></param>
 /// <param name="mes"></param>
 void obj3_OnRecieveMessage(IObject Reciever, PloobsEngine.MessageSystem.Message mes)
 {
     ///Checa se eh a mensagem correta
     if (mes.SenderType == PloobsEngine.MessageSystem.SenderType.EVENT && mes.Tag == "TriggerEvent")
     {
         BepuTrigger trigger = (BepuTrigger)mes.Content;
         mesSend     = mes;
         triggerSend = trigger;
         shouldDraw  = true;
     }
 }
 public void HandleMessage(Message mes)
 {
     Process(mes);
 }
        /// <summary>
        /// Handler que trata das mensagens recebidas pelos dois cubos
        /// handle Message
        /// </summary>
        /// <param name="Reciever"></param>
        /// <param name="mes"></param>
        void obj3_OnRecieveMessage(IObject Reciever, Message mes)
        {
            if (mes.Cod == "CHANGECOLOR")
            {
                ///Muda a Textura do objeto
                Texture2D tex = GraphicFactory.CreateTexture2DColor(1,1, StaticRandom.RandomColor());
                (Reciever.Modelo as SimpleModel).SetTexture(tex, TextureType.DIFFUSE);

                ///Recuperar quem enviou a mensagem 
                long senderId = mes.Sender;
                if (senderId != PrincipalConstants.InvalidId)
                {
                    if (mes.SenderType == SenderType.OBJECT)
                    {
                        IObject sender = (EntityMapper.getInstance().getEntity(senderId) as IObject);
                    }

                }
            }
        }
Exemple #5
0
 void reciever_MessageHandler(PloobsEngine.MessageSystem.Message obj)
 {
     messagesArrived += obj.Content as String;
     messagesArrived += "\n";
 }
 public void HandleMessage(Message mes)
 {
     RecieveMessage(mes);
 }
        /// <summary>
        /// Collision happened
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="other"></param>
        /// <param name="pair"></param>
        void Events_InitialCollisionDetected(BEPUphysics.Collidables.MobileCollidables.EntityCollidable sender, BEPUphysics.Collidables.Collidable other, BEPUphysics.NarrowPhaseSystems.Pairs.CollidablePairHandler pair)
        {
            IObject send = BepuEntityObject.RecoverObjectFromEntity(sender.Entity);
            IObject obj = BepuEntityObject.RecoverObjectFromCollidable(other); 

            ///Verifica se esta bola ja foi considerada
            ///Consider just the first collision
            if (alreadProcessed.Contains(obj.GetId()))
                return;

            alreadProcessed.Add(obj.GetId());

            ///se o objeto colidido for diferente do cenario 
            ///dont consider the island model (triangle meshes in general)
            if (obj.PhysicObject.PhysicObjectTypes != PhysicObjectTypes.TRIANGLEMESHOBJECT)
            {
                shouldDraw = true;

                ///Envia uma mensagem para o canal de comunicacao CUBO
                ///Send a message to the channel
                Message m = new Message(send.GetId(), PrincipalConstants.InvalidId, "cubo", Priority.MEDIUM, -1, SenderType.OBJECT, null, "CHANGECOLOR");
                MessageDeliver.SendMessage(m);

                ///Esta mensagem foi enviada sem Sender (Quem receber a mensagem nao sabera quem enviou)
                ///Envia uma mensagem para o "CUBO QUE VAI MUDAR DE COR" (lembre que o id dele eh 77 !!)
                ///Send a message to the specific  id (first cube)
                m = new Message(PrincipalConstants.InvalidId, 77, null, Priority.MEDIUM, -1, SenderType.OBJECT, null, "CHANGECOLOR");
                MessageDeliver.SendMessage(m);
            }

            objNameTemp = obj.Name;
        }
 public virtual void RecieveMessage(Message message)
 {
     
 }
 protected void SendMessage(String tag, object content)
 {
     Message mes = new Message(id, -1, tag, Priority.MEDIUM, 0, SenderType.NORMAL, content,null);
     MessageDeliver.SendMessage(mes);
 }
 /// <summary>
 /// Chamado qd uma mensagem chega
 /// Handle message
 /// </summary>
 /// <param name="Reciever"></param>
 /// <param name="mes"></param>
 void obj3_OnRecieveMessage(IObject Reciever, PloobsEngine.MessageSystem.Message mes)
 {
     ///Checa se eh a mensagem correta
     if (mes.SenderType == PloobsEngine.MessageSystem.SenderType.EVENT && mes.Tag == "TriggerEvent")
     {         
         BepuTrigger trigger = (BepuTrigger)mes.Content;
         mesSend = mes;
         triggerSend = trigger;
         shouldDraw = true;
     }
 }
        /// <summary>
        /// Processes the specified mes.
        /// </summary>
        /// <param name="mes">The mes.</param>
        public void Process(Message mes)
        {

            HandleEvent(mes.Content as IEvent<Object>);
        }
 public void SendMessage(String title, String Message, String Channel = RadioGeneralChannel)
 {
     Message m = new Message(GetId(), -1, Channel, Priority.HIGH, 0, SenderType.NORMAL, Message, title);
     MessageDeliver.SendMessage(m);
 }
 public void HandleMessage(Message mes)
 {
     if (MessageHandler != null)
         MessageHandler(mes);
 }
 void SystemRecieverMessage_OnMessage(Message obj)
 {
     recievedMessage++;   
 }
 /// <summary>
 /// Handles the message.
 /// </summary>
 /// <param name="mes">The mes.</param>
 public virtual void HandleMessage(Message mes)
 {
     if (OnRecieveMessage != null)
         OnRecieveMessage(this, mes);
 }
 protected void SendMessage(String tag, object content)
 {
     ///Create a system message (SenderType.SYSTEM), cause the listener SystemRecieverMessage is configured to watch this types of messages
     Message mes = new Message(id, -1, tag, Priority.MEDIUM, 0, SenderType.SYSTEM, content,null);
     MessageDeliver.SendMessage(mes);
 }
 /// <summary>
 /// Handles the message.
 /// </summary>
 /// <param name="mes">The mes.</param>
 public virtual void HandleMessage(Message mes)
 {
     if (OnMessage != null)
         OnMessage(mes);
 }
 /// <summary>
 /// handle the message
 /// </summary>
 /// <param name="mes"></param>
 public void HandleMessage(Message mes)
 {
     if (mes.SenderType == PloobsEngine.MessageSystem.SenderType.EVENT && mes.Tag == "TriggerEvent")
     {   
         BepuTrigger trigger = (BepuTrigger)mes.Content;
         mesRec = mes;
     }
 }