コード例 #1
0
        /// <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;
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        protected override void InitScreen(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.EngineStuff engine)
        {
            base.InitScreen(GraphicInfo, engine);

            MessageDeliver md = new MessageDeliver();
            engine.AddComponent(md);
        }
コード例 #4
0
        protected override void InitScreen(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.EngineStuff engine)
        {
            base.InitScreen(GraphicInfo, engine);

            MessageDeliver md = new MessageDeliver();

            engine.AddComponent(md);
        }
コード例 #5
0
 public virtual void FireEvent(object source)
 {
     this._source = source;
     foreach (IEntity item in _targets)
     {
         Message me = new Message(PrincipalConstants.EventSenderId, item.GetId(), null, Priority.LOW, 0, SenderType.EVENT, this, this.Code);
         MessageDeliver.SendMessage(me);
     }
 }
コード例 #6
0
        protected override void InitScreen(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.EngineStuff engine)
        {
            base.InitScreen(GraphicInfo, engine);

            ///Adicionando Componente de Mensagens 
            ///Utilizado pelo Trigger
            ///Triggers uses this component
            MessageDeliver md = new MessageDeliver();
            engine.AddComponent(md);         
        }
コード例 #7
0
        protected override void InitScreen(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.EngineStuff engine)
        {
            base.InitScreen(GraphicInfo, engine);

            ///Adicionando Componente de Mensagens
            ///Utilizado pelo Trigger
            ///Triggers uses this component
            MessageDeliver md = new MessageDeliver();

            engine.AddComponent(md);
        }
コード例 #8
0
        protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory, IContentManager contentManager)
        {
            base.LoadContent(GraphicInfo, factory, contentManager);

            ///script to build the scene
            {
                ScriptParsed ScriptParsed = Parser.ParseScriptFile("Content//Script//script.txt");
                ScriptParsed.References.AddRange(new String[] { "IntroductionDemo4.0.exe", "PloobsEngineDebug.dll" });

                ScriptParsed.UsingStatements.AddRange(new String[] { "IntroductionDemo4._0", "System", "System.Collections.Generic", "System.Text"
                                                                     , "PloobsEngine.Engine", "PloobsEngine.Modelo", "PloobsEngine.Physics.Bepu", "PloobsEngine.Material", "PloobsEngine.SceneControl"
                                                                     , "Microsoft.Xna.Framework", "PloobsEngine.Physics", "PloobsEngine.Utils", "PloobsEngine.Light"
                                                                     , "Microsoft.Xna.Framework.Graphics", "PloobsEngine.Cameras", "PloobsEngine.Features", "PloobsEngine.Commands" });


                Generator GenerateClassCode = new PloobsScripts.Generator(ScriptParsed, "TesteInter", true, true);
                GenerateClassCode.GenerateClass("teste", "ISceneBuilder");
                GenerateClassCode.GenerateMethod("BuildScene", ScriptParsed.MethodCode, typeof(void), System.CodeDom.MemberAttributes.Public | System.CodeDom.MemberAttributes.Override);
                String srt = GenerateClassCode.GetCode(ScriptParsed);

                String   erro     = null;
                Assembly Assembly = Compilers.GenerateAssembly(srt, ScriptParsed.References, out erro);
                if (erro != null)
                {
                    throw new Exception(erro);
                }

                ISceneBuilder interteste = Executor.BindTypeFromAssembly <ISceneBuilder>(Assembly, GenerateClassCode.TypeName);

                interteste.graphicFactory = GraphicFactory;
                interteste.graphicInfo    = GraphicInfo;
                interteste.world          = this.World;
                interteste.renderTechnic  = RenderTechnic;

                interteste.BuildScene();
            }

            ///script to handle messages
            {
                ScriptParsed ScriptParsed = Parser.ParseScriptFile("Content//Script//talk1.txt");
                ScriptParsed.References.AddRange(new String[] { "IntroductionDemo4.0.exe", "PloobsEngineDebug.dll" });

                ScriptParsed.UsingStatements.AddRange(new String[] { "IntroductionDemo4._0", "System", "System.Collections.Generic", "System.Text"
                                                                     , "PloobsEngine.Engine", "PloobsEngine.Modelo", "PloobsEngine.Physics.Bepu", "PloobsEngine.Material", "PloobsEngine.SceneControl"
                                                                     , "Microsoft.Xna.Framework", "PloobsEngine.Physics", "PloobsEngine.Utils", "PloobsEngine.Light"
                                                                     , "Microsoft.Xna.Framework.Graphics", "PloobsEngine.Cameras", "PloobsEngine.MessageSystem", "PloobsEngine.Features", "PloobsEngine.Commands" });

                Generator GenerateClassCode = new PloobsScripts.Generator(ScriptParsed, "IntroductionDemo4._0", true, true);
                GenerateClassCode.GenerateClass("talk", "InterScriptTalking");
                GenerateClassCode.GenerateMethod("execute", ScriptParsed.MethodCode, typeof(void), System.CodeDom.MemberAttributes.Public | System.CodeDom.MemberAttributes.Override);
                String srt = GenerateClassCode.GetCode(ScriptParsed);

                String   erro     = null;
                Assembly Assembly = Compilers.GenerateAssembly(srt, ScriptParsed.References, out erro);
                if (erro != null)
                {
                    throw new Exception(erro);
                }

                interteste = Executor.BindTypeFromAssembly <InterScriptTalking>(Assembly, GenerateClassCode.TypeName);

                interteste.graphicFactory = GraphicFactory;
                interteste.graphicInfo    = GraphicInfo;
                interteste.world          = this.World;
                interteste.renderTechnic  = RenderTechnic;

                interteste.execute();
                EntityMapper.getInstance().AddEntity(interteste);

                SystemRecieverMessage            = new SystemRecieverMessage();
                SystemRecieverMessage.OnMessage += new Action <Message>(SystemRecieverMessage_OnMessage);
                EntityMapper.getInstance().AddgrouptagRecieveEntity("teste", SystemRecieverMessage);

                this.BindInput(new SimpleConcreteKeyboardInputPlayable(StateKey.PRESS, Keys.Space,
                                                                       (a) =>
                {
                    ///5000 is the id of the script
                    ///defined inside it =P look talk1.txt
                    MessageDeliver.SendMessage(new Message(-1, 5000, null, Priority.LOW, 0, SenderType.NORMAL, StaticRandom.PickRandomPoint(new Vector3(100, 100, 100), new Vector3(200, 100, 200), new Vector3(-100, 100, -100)), null));
                }
                                                                       ));
            }
        }
コード例 #9
0
        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);
        }
コード例 #10
0
        /// <summary>
        /// Fires the event.
        /// </summary>
        /// <param name="trigger">The trigger.</param>
        public void FireEvent(ITrigger trigger)
        {
            Message me = new Message(PrincipalConstants.EventSenderId, -1, groupName, Priority.LOW, 0, SenderType.EVENT, trigger, this.Code);

            MessageDeliver.SendMessage(me);
        }
コード例 #11
0
        protected void SendMessage(String tag, object content)
        {
            Message mes = new Message(id, -1, tag, Priority.MEDIUM, 0, SenderType.NORMAL, content, null);

            MessageDeliver.SendMessage(mes);
        }
コード例 #12
0
        public void FireEvent(T data)
        {
            Message me = new Message(PrincipalConstants.EventSenderId, PrincipalConstants.InvalidId, group, Priority.LOW, 0, SenderType.EVENT, data, this.Code);

            MessageDeliver.SendMessage(me);
        }