예제 #1
0
    private void OnTriggerEnter(Collider other) //checks merchant type and generates values accordingly
    {
        if (other.gameObject.CompareTag("Basic Merchant"))
        {
            tradeBuyPrice  = other.gameObject.GetComponent <BasicMerchant>().buyPrice;
            tradeSellPrice = other.gameObject.GetComponent <BasicMerchant>().sellPrice;
            tradeMaxBuy    = other.gameObject.GetComponent <BasicMerchant>().maxBuy;
            tradeMaxSell   = other.gameObject.GetComponent <BasicMerchant>().maxSell;
            Debug.Log(tradeBuyPrice);
            buyButton.UpdateBuyButton(tradeBuyPrice, tradeMaxBuy);
            sellButton.UpdateSellButton(tradeSellPrice, tradeMaxSell);
            gameManagerScript.isMovementActive = false;
            gameManagerScript.OpenTradeWindow();
        }

        else if (other.gameObject.CompareTag("Rare Merchant"))
        {
            time      = other.gameObject.GetComponent <RareMerchant>().time;
            timePrice = other.gameObject.GetComponent <RareMerchant>().timePrice;
            buyTimeButton.UpdateBuyTimeButton(time, timePrice);
            gameManagerScript.isMovementActive = false;
            gameManagerScript.OpenTimeWindow();
        }
    }