示例#1
0
        public void SetInitialRoomIndex(InitialRooms.ID roomIndex)
        {
            Debug.Assert(InitialRooms.IsValidInitialRoomIndex(roomIndex));

            mInitialRoomIndex = roomIndex;

            mDescription = InitialRooms.initialRooms[roomIndex].mDescription;
        }
示例#2
0
        public void Stream(SaveStream stream)
        {
            if (stream.IsWriting())
            {
                Debug.Assert(InitialRooms.IsValidInitialRoomIndex(mInitialRoomIndex));
                stream.Stream(ref mInitialRoomIndex);
            }
            else
            {
                InitialRooms.ID roomIndex = InitialRooms.ID.Unknown;
                stream.Stream(ref roomIndex);
                SetInitialRoomIndex(roomIndex);
                LoadStaticGridFromInitialRoom();
            }

            int dynamicObjectCount = mDynamicObjects.Count;

            stream.Stream(ref dynamicObjectCount, SaveUtils.GetNumBitsToStoreValue(maxNumDynamicObjects));

            if (stream.IsWriting())
            {
                foreach (DynamicObject dynamicObject in mDynamicObjects)
                {
                    dynamicObject.Stream(stream);
                }
            }
            else
            {
                mDynamicObjects.Clear();

                for (int dynamicObjectIndex = 0; dynamicObjectIndex < dynamicObjectCount; dynamicObjectIndex++)
                {
                    DynamicObject dynamicObject = (DynamicObject)Emoji.CreateObject(stream as ReadStream);

                    dynamicObject.Stream(stream);
                    mDynamicObjects.Add(dynamicObject);
                }
            }
        }
示例#3
0
        void LoadDynamicObjectsFromInitialRoom()
        {
            Debug.Assert(InitialRooms.IsValidInitialRoomIndex(mInitialRoomIndex));

            mDynamicObjects = InitialRooms.initialRooms[mInitialRoomIndex].mDynamicObjects;
        }
示例#4
0
        void LoadStaticGridFromInitialRoom()
        {
            Debug.Assert(InitialRooms.IsValidInitialRoomIndex(mInitialRoomIndex));

            mStaticRoomGrid = InitialRooms.initialRooms[mInitialRoomIndex].mStaticRoomGrid;
        }