Example #1
0
        public GraphicsSystem(IEventSystem eventSystem)
        {
            _drawShapeComponent = DrawShapeComponent;
            _drawComponent      = DrawAnimatedComponent;

            _eventSystem = eventSystem;

            _eventSystem.Subscribe <CollisionEvent>(this, (sender, collision) =>
            {
                _collisionArguments.Add(collision);
            });

            _eventSystem.Subscribe <UserInputInfo>(this, (sender, userInputInfo) =>
            {
                switch (userInputInfo.VirtualKey)
                {
                case VirtualKey.Number1 when userInputInfo.IsPressed:
                    _drawPositionHistory = _drawPositionHistory == null ? DrawPositionHistory : default(Action <CanvasDrawingSession, GameObject>);
                    break;
Example #2
0
        public void SubscriberGetsNotified()
        {
            var fakeSubscriber = A.Fake <Action <object, DateTime> >();

            _eventSystem.Subscribe(this, fakeSubscriber);

            var utcNow = DateTime.UtcNow;

            _eventSystem.Send(this, utcNow);

            A.CallTo(() => fakeSubscriber.Invoke(A <object> .That.IsEqualTo(this), A <DateTime> .That.IsEqualTo(utcNow)))
            .MustHaveHappenedOnceExactly();
        }
Example #3
0
 public void Subscribe()
 {
     m_eventSystem.Subscribe <TestEvent>(EventHandler);
 }