예제 #1
0
    /// <summary>
    /// Спавн покупателя с текущим заказом
    /// </summary>
    /// <param name="bSpawnPoint"> Точка спавна </param>
    void Spawn(BuyerSpawnPoint bSpawnPoint)
    {
        int   index    = UnityEngine.Random.Range(0, buyerPrefabs.Length);
        var   newBuyer = Instantiate(buyerPrefabs[index], bSpawnPoint.spawnPoint);
        Buyer buyer    = newBuyer.GetComponent <Buyer>();

        newBuyer.name = $"Char_{currentIndex}";

        var     orderPanel   = Instantiate(orderUI, canvas.transform);
        OrderUI orderPanelUI = orderPanel.GetComponent <OrderUI>();

        orderPanel.name = $"{newBuyer.name}_orderUI";

        buyer.orderUI      = orderPanelUI;
        orderPanelUI.buyer = buyer;

        orderPanel.GetComponent <RectTransform>().anchoredPosition
            = GetCoordinates(bSpawnPoint.spawnPoint, charUI_offsetX, charUI_offsetY, canvas);

        bSpawnPoint.IsEmpty = false;
        var order = orders[currentIndex];

        orderPanelUI.meals[order.Length - 1].SetActive(true);

        foreach (var meal in order)
        {
            var food = Instantiate(meal, orderPanelUI.meals[order.Length - 1].transform);
            buyer.dishList.Add(food);
        }
        buyers.Add(buyer);
        countBuyers--;
        currentIndex++;
        UpdateBuyersCount();
    }
예제 #2
0
 /// <summary>
 /// Новый покуупатель
 /// </summary>
 /// <param name="bSpawnPoint"> Точка спавна </param>
 void NewBuyer(BuyerSpawnPoint bSpawnPoint)
 {
     SpawnCurrent(bSpawnPoint);
 }
예제 #3
0
 /// <summary>
 /// Спавн покупателя с текущим заказом
 /// </summary>
 /// <param name="bSpawnPoint"> Точка спавна </param>
 void SpawnCurrent(BuyerSpawnPoint bSpawnPoint)
 {
     Spawn(bSpawnPoint);
 }
예제 #4
0
 private void Start()
 {
     buyerSpawn = GetComponentInParent <BuyerSpawnPoint>();
 }