public void SetInitialRoomIndex(InitialRooms.ID roomIndex) { Debug.Assert(InitialRooms.IsValidInitialRoomIndex(roomIndex)); mInitialRoomIndex = roomIndex; mDescription = InitialRooms.initialRooms[roomIndex].mDescription; }
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); } } }
void LoadDynamicObjectsFromInitialRoom() { Debug.Assert(InitialRooms.IsValidInitialRoomIndex(mInitialRoomIndex)); mDynamicObjects = InitialRooms.initialRooms[mInitialRoomIndex].mDynamicObjects; }
void LoadStaticGridFromInitialRoom() { Debug.Assert(InitialRooms.IsValidInitialRoomIndex(mInitialRoomIndex)); mStaticRoomGrid = InitialRooms.initialRooms[mInitialRoomIndex].mStaticRoomGrid; }