示例#1
0
    void SpawnCustomer(int stage)
    {
        //spawn the customer at a point determined by the CustomerLocationManager script
        spawnedCustomer = Instantiate(customerPrefab, cLocation.GetOpenSpawn().position, cLocation.GetOpenSpawn().rotation, cLocation.GetOpenSpawn()).GetComponent <CustomerBehavior>();
        CustomerRandomizer cRand = gameObject.AddComponent <CustomerRandomizer>();

        //change the customer's order size based on the game's progress
        switch (stage)
        {
        case 0:
            spawnedCustomer.customerOrder = cRand.CreateRandomCustomer(1);
            break;

        case 1:
            spawnedCustomer.customerOrder = cRand.CreateRandomCustomer(2);
            break;

        case 2:
            spawnedCustomer.customerOrder = cRand.CreateRandomCustomer(3);
            break;

        case 3:
            spawnedCustomer.customerOrder = cRand.CreateRandomCustomer(4);
            break;

        case 4:
            spawnedCustomer.customerOrder = cRand.CreateRandomCustomer(5);
            break;

        case 5:
            spawnedCustomer.customerOrder = cRand.CreateRandomCustomer(6);
            break;

        default:
            break;
        }

        //add a number of images equal to the customer's order size and change their sprite to match the vegetable type
        for (int i = 0; i < spawnedCustomer.customerOrder.Count; i++)
        {
            orderImage = Instantiate(vegetableImagePrefab.gameObject, spawnedCustomer.orderDisplay);
            orderImage.GetComponent <Image>().sprite = vegetableTypes[spawnedCustomer.customerOrder[i]].choppedImage;
        }

        //find the timer slider
        Slider timerSlider = spawnedCustomer.GetComponentInChildren <Slider>();

        //set the customer's wait time based on their order size and reset the timer slider
        spawnedCustomer.waitTime = timePerVegetable * spawnedCustomer.customerOrder.Count;
        timerSlider.maxValue     = spawnedCustomer.waitTime;
        timerSlider.value        = timerSlider.maxValue;
        Destroy(cRand);
    }
示例#2
0
    public void createRandomCustomer(CustomerBehavior cb)
    {
        cb = new CustomerBehavior();
        int typeOfCustomer = Random.Range(0, 3);

        // switch (typeOfCustomer)
        // {
        // case 1:
        //     print ("Ulg, glib, Pblblblblb");
        //     break;
        // default:
        //     print ("Incorrect intelligence level.");
        //     break;
        // }
        cb.timeRemaining = Random.Range(15, 46);
        cb.rollType      = Random.Range(1, 4);
        cb.startseconds  = -1;
    }
示例#3
0
 public void activateScedule(CustomerBehavior c)
 {
     c.activateCustomer();
 }