// Spawns a customer at a random spawn location continuously
 public IEnumerator SpawnCustomers()
 {
     while (true)
     {
         int randomNumber = UnityEngine.Random.Range(0, 100);
         int checkValue   = 100 - GetCustomerSpawnChance();
         if (randomNumber >= checkValue)
         {
             float randValue  = UnityEngine.Random.value;
             bool  enterStore = false;
             int   uniqueID   = Dispensary.GetUniqueCustomerID();
             if (randValue < /*1000*/ .235f && dm.dispensary.schedule.dispensaryOpen) // 23.5 percent chance for customer to enter store
             {
                 enterStore = true;
                 Dispensary.GetUniqueCustomersInStoreCount(); // increments the in-store value
             }
             //  **  Important note - Only two genders  **
             float      randomTwoGender_value = UnityEngine.Random.value;
             string     customerName          = (randomTwoGender_value > .5) ? db.GetRandomFullName(true) : db.GetRandomFullName(false);
             int        spawnCount            = customerSpawnLocations.Count;
             int        rand     = UnityEngine.Random.Range(0, spawnCount - 1);
             GameObject customer = Instantiate(customerModel);
             customer.name = "Customer: " + customerName;
             customer.transform.position = customerSpawnLocations[rand].transform.position;
             try
             {
                 customer.transform.parent = customersParent.transform;
             }
             catch (Exception)
             {
                 CreateCustomerParentObject();
                 customer.transform.parent = customersParent.transform;
             }
             Customer customerComponent = customer.GetComponent <Customer>();
             customerComponent.uniqueID     = uniqueID;
             customerComponent.customerName = customerName;
             customerComponent.OnSpawn(enterStore);
             customers.Add(customerComponent);
         }
         yield return(new WaitForSeconds(1f));
     }
 }
    public void SpawnCustomer() // Command to spawn one customer, at the closest spawn location
    {
        float   distance      = 10000;
        Vector3 spawnLocation = Vector3.zero;

        foreach (GameObject obj in customerSpawnLocations)
        {
            DispensaryManager dispensaryManager = GameObject.Find("DispensaryManager").GetComponent <DispensaryManager>();
            float             newDistance       = Vector3.Distance(obj.transform.position, dispensaryManager.dispensary.Main_c.GetRandomEntryDoor().transform.position);
            if (newDistance < distance)
            {
                distance      = newDistance;
                spawnLocation = obj.transform.position;
            }
        }
        float      randomTwoGender_value = UnityEngine.Random.value;
        string     customerName          = (randomTwoGender_value > .5) ? db.GetRandomFullName(true) : db.GetRandomFullName(false);
        GameObject customer = Instantiate(customerModel);

        customer.name = "Customer: " + customerName;
        customer.transform.position = spawnLocation;
        try
        {
            customer.transform.parent = customersParent.transform;
        }
        catch (Exception)
        {
            CreateCustomerParentObject();
            customer.transform.parent = customersParent.transform;
        }
        Customer customerComponent = customer.GetComponent <Customer>();

        customerComponent.uniqueID = Dispensary.GetUniqueCustomerID();
        Dispensary.GetUniqueCustomersInStoreCount(); // increments the in-store value
        customerComponent.customerName = customerName;
        customerComponent.OnSpawn(true);
        customers.Add(customerComponent);
    }