Exemplo n.º 1
0
        public new static NavigationEngineTestTriggerComponent_Order1st alloc(Action <Entity, List <AEvent> > p_onTriggerEnterHook = null)
        {
            NavigationEngineTestTriggerComponent_Order1st l_instance = new NavigationEngineTestTriggerComponent_Order1st();

            l_instance.IsTriggered        = false;
            l_instance.OnTriggerEnterHook = p_onTriggerEnterHook;
            return(l_instance);
        }
Exemplo n.º 2
0
        public static NavigationEngineTestTriggerComponent_Order2nd alloc(NavigationEngineTestTriggerComponent_Order1st p_triggerSupposedToBeBefore,
                                                                          Action <Entity, List <AEvent> > p_onTriggerEnterHook = null)
        {
            NavigationEngineTestTriggerComponent_Order2nd l_instance = new NavigationEngineTestTriggerComponent_Order2nd();

            l_instance.TriggerSupposedToBeBefore = p_triggerSupposedToBeBefore;
            l_instance.OnTriggerEnterHook        = p_onTriggerEnterHook;
            return(l_instance);
        }
Exemplo n.º 3
0
    public void TriggerComponentTest_executionOrder()
    {
        // Initializing trigger Entity
        Entity l_testTriggerEntity = Entity.alloc();

        l_testTriggerEntity.EntityGameWorld = EntityGameWorld.build(TransformComponent.alloc());

        NavigationEngineTestTriggerComponent_Order1st l_firstTrigger  = NavigationEngineTestTriggerComponent_Order1st.alloc();
        NavigationEngineTestTriggerComponent_Order2nd l_secondTrigger = NavigationEngineTestTriggerComponent_Order2nd.alloc(l_firstTrigger);

        EntityComponent.add_component(l_testTriggerEntity, l_secondTrigger);
        EntityComponent.add_component(l_testTriggerEntity, l_firstTrigger);
        EntityComponent.add_component(l_testTriggerEntity, Locomotion.alloc(new LocomotionData()));

        // We warp the l_testTriggeredEntity to a random NavigationNode
        EventQueue.enqueueEvent(
            TestEventQueue,
            NavigationNodeWarpEntityEvent.alloc(
                l_testTriggerEntity,
                NavigationGraphAlgorithm.pickRandomNode(NavigationGraphContainer.UniqueNavigationGraph)
                )
            );

        EventQueue.iterate(TestEventQueue);

        // We create the Entity that will be involved in the trigger
        Entity l_entity = Entity.alloc();

        l_entity.EntityGameWorld = EntityGameWorld.build(TransformComponent.alloc());

        EntityComponent.add_component(l_entity, Locomotion.alloc(new LocomotionData()));

        EventQueue.enqueueEvent(
            TestEventQueue,
            NavigationNodeWarpEntityEvent.alloc(
                l_entity,
                l_testTriggerEntity.CurrentNavigationNode
                )
            );

        EventQueue.iterate(TestEventQueue);


        NavigationEngineTestTriggerComponent l_triggerComponent = EntityComponent.get_component <NavigationEngineTestTriggerComponent>(l_testTriggerEntity);

        Assert.IsTrue(l_secondTrigger.ExecutedAfterTriggerSupposedToBeBefore);
    }