Ejemplo n.º 1
0
        public void EnsureBothDirections()
        {
            var dictionary = new TwoWayDictionary <int, int>();

            dictionary.Add(1, 2);

            Assert.True(dictionary.ContainsKey(1));
            Assert.True(dictionary.ContainsValue(2));
            Assert.False(dictionary.ContainsKey(2));
            Assert.False(dictionary.ContainsValue(1));
            Assert.Equal(2, dictionary[1]);
            Assert.Equal(1, dictionary.Reverse[2]);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets room description from a given room template.
        /// </summary>
        /// <remarks>
        /// Returns cached result if a given room template was already processed.
        /// </remarks>
        /// <param name="roomTemplate"></param>
        /// <returns></returns>
        protected RoomDescription GetRoomDescription(GameObject roomTemplate)
        {
            if (RoomDescriptionsToRoomTemplates.ContainsValue(roomTemplate))
            {
                return((RoomDescription)RoomDescriptionsToRoomTemplates.GetByValue(roomTemplate));
            }

            var roomDescription = RoomShapesLoader.GetRoomDescription(roomTemplate);

            RoomDescriptionsToRoomTemplates.Add(roomDescription, roomTemplate);

            return(roomDescription);
        }