コード例 #1
0
        void CreateReceiveLogicalMessageList()
        {
            var behaviorList = new BehaviorList<ReceiveLogicalMessageContext>();
            behaviorList.Add<ApplyIncomingMessageMutatorsBehavior>();
            //todo: we'll make this optional as soon as we have a way to manipulate the pipeline
            behaviorList.Add<DataBusReceiveBehavior>();
            behaviorList.Add<LoadHandlersBehavior>();

            foreach (var pipelineOverride in pipelineOverrides)
            {
                pipelineOverride.Override(behaviorList);
            }
            receiveLogicalMessageBehaviorList = behaviorList.InnerList;
        }
コード例 #2
0
        void CreateSendPhysicalMessageList()
        {
            var behaviorList = new BehaviorList<SendPhysicalMessageContext>();

            behaviorList.Add<SerializeMessagesBehavior>();
            behaviorList.Add<MutateOutgoingPhysicalMessageBehavior>();
            behaviorList.Add<DispatchMessageToTransportBehavior>();

            foreach (var pipelineOverride in pipelineOverrides)
            {
                pipelineOverride.Override(behaviorList);
            }

            sendPhysicalMessageBehaviorList = behaviorList.InnerList;
        }
コード例 #3
0
ファイル: Enemy.cs プロジェクト: ReichertMark/PanzerAdmiral
        /// <summary> Create Red Arrow Enemy with arrow Texture </summary>
        public Enemy(Vector2 setPosition, int setHitPoints)
            : base("AI/arrow", new Color(255, 0, 0))
        {
            // Create animation
            _animationCogwheel = new Animation("Enemies/DerGeraet", 7, 5, 0, 32, 1000, true);
            //_animationCogwheel = new Animation("Enemies/cogwheel", 4, 12, 0, 48, 2000, true);
            _animationCogwheel.IsAlive = true;
            _animationCogwheel.Scale   = 0.3f;


            // Assign hitpoints and create rectangle from Texture
            HitPoints     = setHitPoints;
            body          = BodyFactory.CreateRectangle(PhysicsGameScreen.World, ConvertUnits.ToSimUnits(Texture.Width), ConvertUnits.ToSimUnits(Texture.Height), density);
            body.UserData = "enemy";


            // Create Behavior
            enemyNav              = new BehaviorNav(0.2f);
            enemyNav.GoalReached += new EventHandler(enemyNav_GoalReached);
            enemyNav.NodeReached += new EventHandler(enemyNav_NodeReached);
            BehaviorList.Add(enemyNav);

            // set Position and start navigation
            Position = setPosition;
            NavigateToActor(Node.GetClosestNode(setPosition));
        } // Enemy(Vector2 setPosition, int setHitPoints)
コード例 #4
0
        public BombingEnemy(Vector2 setPosition, int setHitPoints)
            : base("Enemies/airship", Color.White)
        {
            // Assign hitpoints and create rectangle from Texture
            HitPoints     = setHitPoints;
            body          = BodyFactory.CreateRectangle(PhysicsGameScreen.World, ConvertUnits.ToSimUnits(Texture.Width), ConvertUnits.ToSimUnits(Texture.Height), density);
            body.UserData = "enemy";

            // set Position and start navigation
            Position = setPosition;
            BehaviorList.Add(new BehaviorConstant(0.2f, new Vector2(-1, 0)));
        } // BombingEnemy(setPosition, setHitPoints)
コード例 #5
0
        public void Add()
        {
            var behaviorList = new BehaviorList <FakeContext>
            {
                InnerList = new List <Type>
                {
                    typeof(Behavior1)
                }
            };

            behaviorList.Add <Behavior2>();
            Assert.AreEqual(2, behaviorList.InnerList.Count);
            Assert.AreEqual(typeof(Behavior2), behaviorList.InnerList[1]);
        }
コード例 #6
0
            public virtual void ReadChildData(BinaryReader reader)
            {
                int x = 0;

                for (x = 0; (x < _specialMovement.Count); x = (x + 1))
                {
                    SpecialMovement.Add(new SpecialMovementBlockBlock());
                    SpecialMovement[x].Read(reader);
                }
                for (x = 0; (x < _specialMovement.Count); x = (x + 1))
                {
                    SpecialMovement[x].ReadChildData(reader);
                }
                for (x = 0; (x < _behaviorList.Count); x = (x + 1))
                {
                    BehaviorList.Add(new BehaviorNamesBlockBlock());
                    BehaviorList[x].Read(reader);
                }
                for (x = 0; (x < _behaviorList.Count); x = (x + 1))
                {
                    BehaviorList[x].ReadChildData(reader);
                }
            }
コード例 #7
0
        void CreateHandlerInvocationList()
        {
            var behaviorList = new BehaviorList<HandlerInvocationContext>();

            behaviorList.Add<SetCurrentMessageBeingHandledBehavior>();
            behaviorList.Add<AuditInvokedSagaBehavior>();
            behaviorList.Add<SagaPersistenceBehavior>();
            behaviorList.Add<InvokeHandlersBehavior>();

            foreach (var pipelineOverride in pipelineOverrides)
            {
                pipelineOverride.Override(behaviorList);
            }
            handlerInvocationBehaviorList = behaviorList.InnerList;
        }
コード例 #8
0
        void CreateReceivePhysicalMessageList()
        {
            var behaviorList = new BehaviorList<ReceivePhysicalMessageContext>();

            behaviorList.Add<ChildContainerBehavior>();
            behaviorList.Add<MessageHandlingLoggingBehavior>();
            behaviorList.Add<ImpersonateSenderBehavior>();
            behaviorList.Add<AuditBehavior>();
            behaviorList.Add<ForwardBehavior>();
            behaviorList.Add<UnitOfWorkBehavior>();
            behaviorList.Add<ApplyIncomingTransportMessageMutatorsBehavior>();
            behaviorList.Add<RaiseMessageReceivedBehavior>();
            behaviorList.Add<RemoveIncomingHeadersBehavior>();
            behaviorList.Add<ExtractLogicalMessagesBehavior>();
            behaviorList.Add<CallbackInvocationBehavior>();
            behaviorList.Add<ExecuteLogicalMessagesBehavior>();

            foreach (var pipelineOverride in pipelineOverrides)
            {
                pipelineOverride.Override(behaviorList);
            }
            receivePhysicalMessageBehaviorList = behaviorList.InnerList;
        }
コード例 #9
0
        void CreateSendLogicalMessageList()
        {
            var behaviorList = new BehaviorList<SendLogicalMessageContext>();

            behaviorList.Add<SendValidatorBehavior>();
            behaviorList.Add<SagaSendBehavior>();
            behaviorList.Add<MutateOutgoingMessageBehavior>();
            //todo: we'll make this optional as soon as we have a way to manipulate the pipeline
            behaviorList.Add<DataBusSendBehavior>();

            foreach (var pipelineOverride in pipelineOverrides)
            {
                pipelineOverride.Override(behaviorList);
            }
            sendLogicalMessageBehaviorList = behaviorList.InnerList;
        }
コード例 #10
0
        void CreateSendLogicalMessagesList()
        {
            var behaviorList = new BehaviorList<SendLogicalMessagesContext>();

            behaviorList.Add<MultiSendValidatorBehavior>();
            behaviorList.Add<MultiMessageBehavior>();
            behaviorList.Add<CreatePhysicalMessageBehavior>();

            foreach (var pipelineOverride in pipelineOverrides)
            {
                pipelineOverride.Override(behaviorList);
            }
            sendLogicalMessagesBehaviorList = behaviorList.InnerList;
        }
コード例 #11
0
 public override void Override(BehaviorList <ReceiveLogicalMessageContext> behaviorList)
 {
     //and also hook into to logical receive pipeline to make filtering on message types easier
     behaviorList.Add <MyFilteringAuditBehavior>();
 }
コード例 #12
0
 public override void Override(BehaviorList<ReceivePhysicalMessageContext> behaviorList)
 {
     behaviorList.Add<LicenseBehavior>();
 }
コード例 #13
0
 public override void Override(BehaviorList <ReceivePhysicalMessageContext> behaviorList)
 {
     behaviorList.Add <LicenseBehavior>();
 }