コード例 #1
0
 // Update is called once per frame
 void Update()
 {
     if (second != mm.getSecond())
     {
         timer++;
         second = mm.getSecond();
     }
     if (p.budget + offered < 0)
     {
         message.text = "Select properties to pay off your debts.\nAmount needed: $" + p.budget + "\nAmount offered: $" + offered + "\n";
     }
     else
     {
         message.text = "Price met. \nBudget after this deal: $" + (p.budget + offered);
     }
 }
コード例 #2
0
    // Use this for initialization
    void Start()
    {
        p = FindObjectOfType <Player> ().localPlayer;
        p.controlsAllowed(false);
        mm      = FindObjectOfType <MonthManager> ();
        offered = 0;
        content = transform.Find("Viewport/Content");
        confirm = gameObject.transform.Find("Button").GetComponent <Button> ();
        confirm.onClick.AddListener(delegate {
            submit();
        });
        message = gameObject.transform.Find("Panel/Text").GetComponent <Text> ();
        toSell  = new List <Building> ();
        if (p.budget + offered < 0)
        {
            message.text = "Select properties to pay off your debts.\nAmount needed: $" + p.budget + "\nAmount offered: $" + offered + "\n";
        }
        else
        {
            message.text = "Price met.";
        }
        second = mm.getSecond();
        timer  = 0;
        transform.SetParent(GameObject.Find("Canvas").transform, false);
        prefab = (GameObject)Resources.Load("BankruptcyToggle");
        List <Building> tmp = p.getBuildings();

        hoods = tmp.Where(b => (b is Neighborhood)).ToList();
        lots  = tmp.Where(b => ((b is Lot) && !b.inNeighborhood())).ToList();
        ypos  = 0;
        foreach (Building b in hoods)
        {
            spawnToggle(b);
        }
        foreach (Building b in lots)
        {
            spawnToggle(b);
        }
        if ((p.propertyValue() + p.budget) < 0)
        {
            seizeAll();
        }
    }