public void SpawnCustomer(Customer_s savedData)
    {
        GameObject customer = Instantiate(customerModel);

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

        customerComponent.pathfinding.currentAction = savedData.customerPathfinding.action;
        customerComponent.uniqueID     = savedData.uniqueID;
        customerComponent.customerName = savedData.customerName;
        if (savedData.customerPathfinding.isMovingOutside)
        {
            customerComponent.OnSpawn(savedData.enteringStore); // Outdoor onspawn
        }
        else
        {
            customerComponent.OnSpawn(); // Indoor onspawn
        }
        customers.Add(customerComponent);
    }
Ejemplo n.º 2
0
    public Customer_s MakeSerializable() // Called on active customers to save pathfinding and position
    {
        // Setup desired products to be saved
        List <Product_s> newDesiredProductsList = new List <Product_s>();

        /*if (desiredProducts.Count > 0)
         * {
         *  foreach (Product product in desiredProducts)
         *  {
         *      newDesiredProductsList.Add(product.MakeSerializable());
         *  }
         * }
         * else
         * {
         *  newDesiredProductsList = null;
         * }*/
        Customer_s returnCustomer = new Customer_s(customerName, uniqueID, pathfinding.MakeSerializable());

        //returnCustomer.desiredProducts = newDesiredProductsList;
        //returnCustomer.desiredStrains = desiredStrains;
        returnCustomer.enteringStore = enteringStore;
        returnCustomer.smokeLounge   = smokeLounge;
        return(returnCustomer);
    }
Ejemplo n.º 3
0
    public Customer_s GetReturnCustomerData() // Called when a customer decides to come back. saves this customers info in a list in dispensary
    {
        // Setup desired products to be saved
        List <Product_s> newDesiredProductsList = new List <Product_s>();

        /* (desiredProducts.Count > 0)
         * {
         *  foreach (Product product in desiredProducts)
         *  {
         *      newDesiredProductsList.Add(product.MakeSerializable());
         *  }
         * }
         * else
         * {
         *  newDesiredProductsList = null;
         * }*/
        Customer_s newReturnCustomer = new Customer_s(customerName, uniqueID);

        //newReturnCustomer.desiredProducts = newDesiredProductsList;
        //newReturnCustomer.desiredStrains = desiredStrains;
        newReturnCustomer.enteringStore = false; // false because this customer isnt active
        newReturnCustomer.smokeLounge   = smokeLounge;
        return(newReturnCustomer);
    }