コード例 #1
0
 public void closePanel()
 {
     tile = null;
     gameObject.SetActive(false);
 }
コード例 #2
0
    public void initializePanel(intrusionDetection selected)
    {
        tile         = selected;
        money        = currencyCTRL.GetComponent <currencyCounter>();
        healRedPrice = 200 - (int)(tile.redHealthRatio() * 200);

        if (!tile.isRedActive())
        {
            redHealthBar.rectTransform.localScale = new Vector2(tile.redHealthRatio(), 1);
            if (money.isPurchaseable(200))
            {
                redButtonText.text = "Purchase Red Archer \n$200";
            }
            else
            {
                redButtonText.text = "Insufficient Funds";
            }
        }
        else
        {
            if (healRedPrice < 75)
            {
                if (money.isPurchaseable(75))
                {
                    redButtonText.text = "Heal Red Archer \n$75";
                }
                else
                {
                    redButtonText.text = "Insufficient Funds";
                }
            }
            else
            {
                if (money.isPurchaseable(healRedPrice))
                {
                    redButtonText.text = "Heal Red Archer \n$" + healRedPrice;
                }
                else
                {
                    redButtonText.text = "Insufficient Funds";
                }
            }
            redHealthBar.rectTransform.localScale = new Vector2(tile.redHealthRatio(), 1);
        }

        if (tile.isBlueActive())
        {
            blueActive.text     = "Active";
            blueButtonText.text = "Blue Archer Active";
        }
        else
        {
            blueActive.text = "Inactive";
            if (money.isPurchaseable(100))
            {
                blueButtonText.text = "Purchase Blue Archer \n$100";
            }
            else
            {
                blueButtonText.text = "Insufficient Funds";
            }
        }

        if (!tile.isOrangeActive())
        {
            orangeVision.text = "Inactive";
            if (money.isPurchaseable(500))
            {
                orangeButtonText.text = "Purchase Orange Archer \n$500";
            }
            else
            {
                orangeButtonText.text = "Insufficient Funds";
            }
        }
        else
        {
            if (money.isPurchaseable(500))
            {
                orangeButtonText.text = "Heal Orange Archer \n$200";
            }
            else
            {
                orangeButtonText.text = "Insufficient Funds";
            }

            switch (tile.perception())
            {
            case 4:
                orangeVision.text = "Peerless";
                break;

            case 3:
                orangeVision.text = "Okay";
                break;

            case 2:
                orangeVision.text = "Blurry";
                break;

            case 1:
                orangeVision.text = "Almost Blind";
                break;
            }
        }
        redVisited.text    = tile.redsVisited().ToString();
        blueVisited.text   = tile.bluesVisited().ToString();
        orangeVisited.text = tile.orangesVisited().ToString();
        grayVisited.text   = tile.graysVisited().ToString();
    }