示例#1
0
        // Start is called before the first frame update
        void Start()
        {
            BookShelf bookShelf = new BookShelf();

            bookShelf.appendBook(new Book("Around the World in  Days"));
            bookShelf.appendBook(new Book("Bible"));
            bookShelf.appendBook(new Book("Ciderella"));
            bookShelf.appendBook(new Book("Daddy-Long-Legs"));
            bookShelf.appendBook(new Book("End"));
            Iterator it       = bookShelf.iterator();
            float    positonX = 0;
            float    positonY = 0;
            float    positonZ = 0;

            while (it.hasNext())
            {
                Book book = (Book)it.next();
                book.setPosition(new Vector3(positonX, positonY, positonZ));
                Debug.Log(book.getName());
                positonZ += 1.5f;
            }
        }
 public BookShelfIterator(BookShelf bookShelf)
 {
     this.bookShelf = bookShelf;
     this.index     = 0;
 }