Beispiel #1
0
    private void Init()
    {
        foreach (SaverLoader.GameData.BookStorage bookStorage in CurrentSave.BookStorages)
        {
            BookStorage bookStorageInstance = null;
            switch (bookStorage.Type)
            {
            case SaverLoader.GameData.BookStorage.BuildingType.Bookshelf:
                bookStorageInstance = Instantiate(pm.BookshelfPrefab, bookStorage.Position, bookStorage.Rotation);
                break;

            case SaverLoader.GameData.BookStorage.BuildingType.Checkout:
                bookStorageInstance = Instantiate(pm.CheckoutPrefab, bookStorage.Position, bookStorage.Rotation);
                ((Checkout)bookStorageInstance).dropOffCheckout = bookStorage.DropOffCheckout;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            foreach (int bookId in bookStorage.BookIds)
            {
                BookModel bookModel = BookModel.Instantiate(bm.Books[bookId]);
                bookStorageInstance.AddBook(bookModel, true);
            }

            bookStorageInstance.Init();
        }

        foreach (int bookId in CurrentSave.TransportedBooks)
        {
            BookModel bookModel = BookModel.Instantiate(bm.Books[bookId]);
            PlayerTransport.AddBook(bookModel, true);
            PlayerTransport.booksToStore.Add(bookModel);
        }
    }