public void AddOrderToList(bool roastedChic, bool ricePlain, bool haveEgg)
    {
        ChickenRice tempHolder = OrderGeneration.Instance.CreateCustomOrder(roastedChic, ricePlain, haveEgg);

        OrderIconList.Add(tempHolder);
        SpawnOrderIcon(tempHolder.OrderIcon);
    }
    public void CheckCanServeDish(VR_OrderSlipBehaviour _orderSlip = null, ChickenRice _chickenRiceOrder = null)
    {
        //get the index num of the empty space on the counter
        int indexNum = SpawnDishOnCounter.Instance.CheckCounterHasSpace(); //returns -1 if there is no space

        ChickenRice orderDetails;

        if (_orderSlip != null)
        {
            //get the details of the order indicated on the orderslip
            orderDetails = _orderSlip.OrderSlipOrder;
        }
        else if (_chickenRiceOrder != null)
        {
            orderDetails = _chickenRiceOrder;
        }
        else
        {
            Debug.Log("Please pass an order slip into this function");
            return;
        }


        if (indexNum > -1) // if there is space on the counter, remove the order slip and spawn the dish
        {
            SpawnDishOnCounter.Instance.ServerSpawnDish(indexNum, orderDetails.RoastedChic, orderDetails.RicePlain, orderDetails.HaveEgg);

            RemoveOrderSlip(orderDetails);
        }
        else //if the serve counter is full, give feedback
        {
            Debug.Log("Service counter is too full to spawn dish");
        }
    }
    public void CmdRemoveOrder()
    {
        NetworkServer.Destroy(orderIcon.gameObject);
        Debug.Log("ordericon has been destroyed");

        currentOrder = null;
        Debug.Log("current order is now null");
    }
    public void SpawnOrderSlip(ChickenRice _chickenRiceOrder)
    {
        Debug.Log("Spawn Order slip called for " + _chickenRiceOrder.ChickenRiceLabel);
        //pick an empty order slip

        //customize the order slip

        //make the order slip visible
    }
    public void CmdCreateOrder()
    {
        currentOrder = OrderGeneration.Instance.CreateNewOrder();
        Debug.Log(currentOrder.ChickenRiceLabel);

        orderIcon = Instantiate(currentOrder.OrderIcon, UISpawnPos.position, UISpawnPos.rotation);
        NetworkServer.Spawn(orderIcon);
        Debug.Log(orderIcon.name);
    }
    /*
     * private void Update()
     * {
     *  if (Input.GetKeyDown(KeyCode.X))
     *  {
     *      CustomizeOrderSlip(OrderGeneration.Instance.CreateCustomOrder(Random.value > 0.5f, Random.value > 0.5f, Random.value > 0.5f));
     *      Debug.Log("customizing order slip");
     *  }
     * }
     */
    #endregion


    //assign an order to the order slip and customize its appearance. start aging the background color
    public void CustomizeOrderSlip(ChickenRice order)
    {
        orderSlipOrder = order;

        //enable all the relevant icons
        ToggleIcons(true);

        //start aging the background
        StartChangingBackgroundColor();
    }
    public ChickenRice CreateCustomOrder(bool roastedChic, bool ricePlain, bool haveEgg)
    {
        ChickenRice newOrder = new ChickenRice(roastedChic, ricePlain, haveEgg);

        newOrder.ChickenRiceLabel = newOrder.IdentifyChickenRice();
        newOrder.OrderIcon        = this.IdentifyIcon(newOrder.ChickenRiceLabel);
        //Debug.Log("Order generated. Does customer want chicken roasted? " + newOrder.RoastedChic + ". Rice plain? " + newOrder.RicePlain + ". Include egg? " + newOrder.HaveEgg + ". Include cucumber? " + newOrder.Cucumber + ". Have label? " + newOrder.ChickenRiceLabel + ". Have icon? " + (newOrder.OrderIcon != null));

        return(newOrder);
    }
    //method to randomly generate an order
    public ChickenRice CreateNewOrder()
    {
        ChickenRice newOrder = new ChickenRice(Random.value > 0.5f, Random.value > 0.5f, Random.value > 0.5f);

        newOrder.ChickenRiceLabel = newOrder.IdentifyChickenRice();
        newOrder.OrderIcon        = this.IdentifyIcon(newOrder.ChickenRiceLabel);
        //Debug.Log("Order generated. Does customer want chicken roasted? " + newOrder.RoastedChic + ". Rice plain? " + newOrder.RicePlain + ". Include egg? " + newOrder.HaveEgg + ". Include cucumber? " + newOrder.Cucumber + ". Have label? " + newOrder.ChickenRiceLabel + ". Have icon? " + (newOrder.OrderIcon != null));

        return(newOrder);
    }
    public void RemoveOrderSlip(ChickenRice _chickenRiceOrder)
    {
        Debug.Log("remove order slip called");

        //remove the order from the order slip list
        currentlyDisplayedOrders.Remove(_chickenRiceOrder);

        //check if there are hidden orders
        //display the first hidden order
        //update the hidden order count obj
    }
Exemplo n.º 10
0
    //Instantiates the order being served
    public void SpawnDish(ChickenRice dishDetails)
    {
        //returns -1 if the counter is full
        int indexNum = CheckCounterSpace();

        if (indexNum > -1)
        {
            //instantiate a new dish as a child of an empty spot on the counter
            Instantiate(IdentifyOrder(dishDetails.ChickenRiceLabel), dishSpawnPoints[indexNum]);
        }
    }
Exemplo n.º 11
0
    public bool CheckCorrespondingOrderSlip(ChickenRice _orderSlipOrder)
    {
        if (CheckMinRequirements())
        {
            AssignDishDetails();

            return(correspondingDishDetails.ChickenRiceLabel == _orderSlipOrder.ChickenRiceLabel);
        }

        return(false);
    }
Exemplo n.º 12
0
    //if there is enough space to display another order slip, display the order slip and add it to the list of orders being displayed
    //if not, add the order to the list of hidden orders + update the hidden order count obj
    public void AddOrderToList(bool roastedChic, bool ricePlain, bool haveEgg)
    {
        ChickenRice tempOrderHolder = OrderGeneration.Instance.CreateCustomOrder(roastedChic, ricePlain, haveEgg);

        if (currentlyDisplayedOrders.Count() < orderSlips.Length)
        {
            currentlyDisplayedOrders.Add(tempOrderHolder);
            SpawnOrderSlip(tempOrderHolder);
        }
        else
        {
            AddHiddenOrder(tempOrderHolder);
        }
    }
    //reset all the values and stop the aging
    public void ResetOrderSlip()
    {
        //disable all the relevant icons
        ToggleIcons(false);

        orderSlipOrder = null;

        //stop aging the background
        if (isBackgroundFading)
        {
            StopChangingBackgroundColor();
        }

        fadeBackground = true;
    }
    //add the passed in chicken rice order to the list of orders
    public void AddOrderToList(bool roastedChic, bool ricePlain, bool haveEgg)
    {
        ChickenRice tempOrderHolder = OrderGeneration.Instance.CreateCustomOrder(roastedChic, ricePlain, haveEgg);

        //Check if should spawn in order slip or hide order first (order slip full)
        if (currentlyDisplayedOrders.Count() < orderSlipSpawnPoints.Length)
        {
            currentlyDisplayedOrders.Add(tempOrderHolder);
            SpawnOrderSlip(tempOrderHolder);
        }
        else
        {
            hiddenOrders.Add(tempOrderHolder);
            Debug.Log("hiddenOrders: " + hiddenOrders.Count);
        }
    }
Exemplo n.º 15
0
    public void RpcGenerateOrder(bool roastedChic, bool ricePlain, bool haveEgg)
    {
        CustomerFeedbackScript.PlayHappyPFX();
        CustomerPatienceScript.CustomerState = CustomerPatienceScript.CustomerOrdering;

        customersOrder = orderGenerationScript.CreateCustomOrder(roastedChic, ricePlain, haveEgg);

        if (customersOrder.OrderIcon != null)
        {
            //instantiate the order icon as the child of the orderIconPos obj

            GameObject orderIcon = Instantiate(customersOrder.OrderIcon, orderIconPos);
            //GameManager.Instance.chickenRiceOrders.Add(customersOrder);
            //NetworkServer.Spawn(orderIcon);
        }
    }
Exemplo n.º 16
0
    //-----------------------------------------------------------------SERVING AN ORDER-----------------------------------------------------------------------
    //method to serve the dish that the order slip is being placed on
    public void CheckCanServeDish(VR_OrderSlipBehaviour _orderSlip)
    {
        ChickenRice orderDetails = _orderSlip.OrderSlipOrder;

        //get the index num of the empty space on the counter
        int indexNum = SpawnDishOnCounter.Instance.CheckCounterHasSpace(); //returns -1 if there is no space

        // if there is space on the counter, remove the order slip and spawn the dish
        if (indexNum > -1)
        {
            //SpawnDishOnCounter.Instance.SpawnDish(indexNum, orderDetails.RoastedChic, orderDetails.RicePlain, orderDetails.HaveEgg);

            RemoveOrderSlip(_orderSlip);
        }
        else //if the serve counter is full, give feedback
        {
            Debug.Log("Service counter is too full to spawn dish");
        }
    }
Exemplo n.º 17
0
    //checks for an empty order slip, prints the order passed in on the order slip and displays it.
    //If there are no empty order slips, the order is added to the hidden orders
    public void SpawnOrderSlip(ChickenRice _chickenRiceOrder)
    {
        Debug.Log("Spawn Order slip called for " + _chickenRiceOrder.ChickenRiceLabel);

        //pick an empty order slip
        GameObject emptyOrderSlip = CheckEmptyOrderSlip();

        if (emptyOrderSlip != null)
        {
            //customize the order slip
            emptyOrderSlip.GetComponent <VR_OrderSlipBehaviour>().CustomizeOrderSlip(_chickenRiceOrder);

            //make the order slip visible
            emptyOrderSlip.SetActive(true);
        }
        else
        {
            AddHiddenOrder(_chickenRiceOrder);
        }
    }
Exemplo n.º 18
0
    public void ServerSpawnDish(int _indexNum, bool isRoasted, bool ricePlain, bool haveEgg)
    {
        ChickenRice dishToBeSpawned = OrderGeneration.Instance.CreateCustomOrder(isRoasted, ricePlain, haveEgg);

        GameObject newDish = Instantiate(objectContainerPrefab, GameManager.Instance.dishSpawnPoints[_indexNum].position, GameManager.Instance.dishSpawnPoints[_indexNum].rotation);

        newDish.GetComponent <Rigidbody>().isKinematic = false;

        ObjectContainer dishContainer = newDish.GetComponent <ObjectContainer>();

        //Instantiate the right held item
        dishContainer.SetObjToSpawn(IdentifyOrder(dishToBeSpawned.ChickenRiceLabel));

        //Sync var
        dishContainer.objToSpawn = IdentifyOrder(dishToBeSpawned.ChickenRiceLabel);

        //Spawn on network
        NetworkServer.Spawn(newDish);

        RpcSpawnDish(_indexNum, newDish);
    }
    //if there is enough space to display another order slip, display the order slip and add it to the list of orders being displayed
    //if not, add the order to the list of hidden orders + update the hidden order count obj
    public void SortOrderToList(ChickenRice _chickenRiceOrder)
    {
        //pick an empty order slip
        GameObject emptyOrderSlip = CheckEmptyOrderSlip();

        if (emptyOrderSlip != null)
        {
            currentlyDisplayedOrders.Add(_chickenRiceOrder);

            //customize the order slip
            emptyOrderSlip.GetComponent <VR_OrderSlipBehaviour>().CustomizeOrderSlip(_chickenRiceOrder);

            //make the order slip visible
            emptyOrderSlip.GetComponent <VR_OrderSlipBehaviour>().ToggleColliderAndVisuals(true);

            emptyOrderSlip.GetComponent <VR_OrderSlipBehaviour>().StartChangingBackgroundColor();
        }
        else
        {
            AddHiddenOrder(_chickenRiceOrder);
        }
    }
Exemplo n.º 20
0
 //add an order to the hidden order list
 private void AddHiddenOrder(ChickenRice _chickenRiceOrder)
 {
     hiddenOrders.Add(_chickenRiceOrder);
     UpdateHiddenOrdersCount();
 }
Exemplo n.º 21
0
 private void AssignDishDetails()
 {
     correspondingDishDetails = OrderGeneration.Instance.CreateCustomOrder(roastedChic, ricePlain, haveEgg);
 }
 public void RemoveOrder(ChickenRice _chickenRiceOrder)
 {
     newOrders.Remove(_chickenRiceOrder);
 }
    public void AddOrderToList(bool roastedChic, bool ricePlain, bool haveEgg)
    {
        ChickenRice tempOrderHolder = OrderGeneration.Instance.CreateCustomOrder(roastedChic, ricePlain, haveEgg);

        newOrders.Add(tempOrderHolder);
    }
    public static void AddOrderToList(ChickenRice _order)
    {
        OrderIconList.Add(_order);

        Temp_VRSpawnOrder.Instance.SpawnOrderIcon(_order.OrderIcon);
    }
Exemplo n.º 25
0
 //Toggle icons on order slip depending on the requirements of the dish
 public void CustomizeOrderSlip(ChickenRice order)
 {
     isChicRoasted[Convert.ToInt32(order.RoastedChic)].SetActive(true);
     isRicePlain[Convert.ToInt32(order.RicePlain)].SetActive(true);
     includesEgg[Convert.ToInt32(order.HaveEgg)].SetActive(true);
 }