Example #1
0
    private void GenerateLaundry()
    {
        Basket basket = new Basket();

        bone = new OllieFemur();

        Fabric cotton = new Fabric(FabricType.Cotton);

        basket.AddGarment(bone);
        basket.AddGarment(new GarmentUnderwear(cotton, GarmentColor.White));
        basket.AddGarment(new GarmentSock(cotton, GarmentColor.Red));
        basket.AddGarment(new GarmentUnderwear(cotton, GarmentColor.White));
        basket.AddGarment(new GarmentSock(cotton, GarmentColor.Red));
        basket.AddGarment(new GarmentShirt(cotton, GarmentColor.Teal));
        basket.AddGarment(new GarmentTop(cotton, GarmentColor.White));
        basket.AddGarment(new GarmentTop(cotton, GarmentColor.Salmon));

        ollie.basket = basket;

        ollie.garments = new List <Garment>();

        for (int i = 0; i < basket.contents.Count; i++)
        {
            ollie.garments.Add(basket.contents[i]);
        }
    }
Example #2
0
    private void Start()
    {
        GameObject laundromatBasketPrefab = (GameObject)Resources.Load("LaundromatBasket");

        RecurringCustomer customer = CustomerManager.instance.GetRecurringCustomer(characterIndex);
        Garment           bone     = new OllieFemur();

        Basket basket = LaundryManager.GetRandomBasket();

        while (!basket.AddGarment(bone))
        {
            //If there is no space in the basket for the bone, remove something
            Garment removed = basket.RemoveTopGarment();
            //If the removed garment is a sock, remove its match
            if (removed is GarmentSock)
            {
                foreach (Garment garment in basket.contents)
                {
                    if (garment is GarmentSock)
                    {
                        if (garment.color.Equals(removed.color) && garment.fabric.Equals(removed.fabric))
                        {
                            basket.RemoveGarment(garment);
                            break;
                        }
                    }
                }
            }
        }

        List <Garment> olliesGarments = new List <Garment>();

        foreach (Garment garment in basket.contents)
        {
            garment.customerID = customerID;
            olliesGarments.Add(garment);
        }

        customer.basket   = basket;
        customer.garments = olliesGarments;
    }