Ejemplo n.º 1
0
        public void RoomContentCreationTestTwoBasic()
        {
            //Chuck an array of IRoomContent to the Room constructor
            IRoomContent[] roomContent = new IRoomContent[] { new Kobold(), new Skeleton() };

            Room room = new Room(roomContent);

            //Again, similar to the Dungeon test of a similiar nature, do a simple count of content items and ensure it's correct
            Assert.AreEqual <int>(roomContent.Length, room.RoomFeatures.Count, "RoomContentCreationTestTwoBasic (RoomTests) failed. Test array room Content count differs to room.RoomFeatures.Count.");
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Represents APIs of rooms' management
        /// </summary>
        /// <param name="transitionHandler">This will subscribe asynchronous porocesses that will happen when rooms changed</param>
        /// <param name="hooks">Public rooms events. Any action might be subscribed to them.</param>
        /// <param name="content">Room content mananger</param>
        /// <param name="roomsChanger">Use this API when you need to change the current room</param>
        /// <param name="subscriber">Subscribes objects of type IRoomEventListener to room events</param>
        /// <param name="mediators">Classes which should connect APIs' events whith each other</param>
        public RoomsManager(IRoomTransitionHandler <R> transitionHandler = null,
                            IRoomEventsHooks <E, R> hooks           = null,
                            IRoomContent <O, R> content             = null,
                            IRoomsChanger <R> roomsChanger          = null,
                            IRoomEventsSubscriber <E, R> subscriber = null,
                            params IRoomsHooksMediator <E, R, O>[] mediators)
        {
            TransitionHandler = transitionHandler;
            Hooks             = hooks ?? new RoomEventsHooks <E, R>();
            Content           = content ?? new RoomContentList <O, R>();
            RoomsChanger      = roomsChanger ?? new RoomChanger <R>(TransitionHandler);
            EventsSubscriber  = subscriber ?? new RoomEventsSubscriber <E, R>(Hooks);

            _mediators = mediators;
            foreach (var mediator in _mediators)
            {
                mediator.Connect(this);
            }
        }