Ejemplo n.º 1
0
    private void OnDestroy()
    {
        CEventSystem.RemoveEventHandler(EventChannel.input, EventSubChannel.player1, this);
        CEventSystem.RemoveEventHandler(EventChannel.gameState, EventSubChannel.none, this);

        SnakeDestroyer.Create(gameObject, tailPieces.Select(x => x.gameObject));
        instance = null;
    }
    public void EventSystemBaseTestSimplePasses()
    {
        //Check that the event system is empty
        Assert.True(CEventSystem.Count == 0);

        //create an event, add it to the system, and check the count
        TestEventObject testEvent = new TestEventObject();

        CEventSystem.AddEventHandler(category.category, category.subcategory, testEvent);
        Assert.True(CEventSystem.Count == 1);

        //Check the state of the test class after broadcasting a set true, set false, and foo event
        Assert.True(!testEvent.State);
        CEventSystem.BroadcastEvent(category.category, category.subcategory, new SetTrueEvent());
        Assert.True(testEvent.State);
        CEventSystem.BroadcastEvent(category.category, category.subcategory, new SetFalseEvent());
        Assert.True(!testEvent.State);
        CEventSystem.BroadcastEvent(category.category, category.subcategory, new FooEvent());
        Assert.True(!testEvent.State);

        //remove the event, check the count of the system.
        CEventSystem.RemoveEventHandler(category.category, category.subcategory, testEvent);
        Assert.True(CEventSystem.Count == 0);
    }
Ejemplo n.º 3
0
 private void OnDestroy()
 {
     CEventSystem.RemoveEventHandler(EventChannel.gameState, EventSubChannel.none, this);
 }