public static void SecondDemo()
        {
            Collection collection = new Collection();

            collection[0] = new Item("Item 0");
            collection[1] = new Item("Item 1");
            collection[2] = new Item("Item 2");
            collection[3] = new Item("Item 3");
            collection[4] = new Item("Item 4");
            collection[5] = new Item("Item 5");
            collection[6] = new Item("Item 6");
            collection[7] = new Item("Item 7");
            collection[8] = new Item("Item 8");

            // Create iterator

            Itterator iterator = collection.CreateIterator();

            // Skip every other item

            iterator.Step = 2;

            Console.WriteLine("Iterating over collection:");

            for (Item item = iterator.First();
                 !iterator.IsDone; item = iterator.Next())
            {
                Console.WriteLine(item.Name);
            }

            // Wait for user

            Console.ReadKey();
        }
Exemplo n.º 2
0
    // Start is called before the first frame update
    void Start()
    {
        j = Itterator.first();
        // creates a new fog object of a set size across the screen
        coordinatesx = new List <int>()
        {
            0, 5, 5, -20, -20, 0, 5, 35, 37, 36, 13
        };
        coordinatesy = new List <int>()
        {
            0, -15, -30, -35, -20, -45, -60, -50, -39, -29, -41
        };

        // This covers a whole section of the cave system
        while (!Itterator.isDone(11))
        {
            Instantiate(fog, new Vector2(coordinatesx[j], coordinatesy[j]), transform.rotation);
            j = Itterator.next();
        }
    }