コード例 #1
0
        // We die sad if we were killed by a turret
        // in this case, we increase the player's money
        void DieSad()
        {
            Destroy(gameObject);
            Home_Base hb = FindObjectOfType <Home_Base>();

            hb._money         += 2.0f;
            hb.money_text.text = "$" + hb._money;
        }
コード例 #2
0
        // Use this for initialization
        void Start()
        {
            hb      = GameObject.FindObjectOfType <Home_Base>();
            yes_btn = GameObject.FindGameObjectWithTag("yes_btn").GetComponent <Button>();
            no_btn  = GameObject.FindGameObjectWithTag("no_btn").GetComponent <Button>();
            if (hb._money < 5)
            {
                yes_btn.interactable = false;
            }
            else
            {
                yes_btn.onClick.AddListener(YesClicked);
            }

            no_btn.onClick.AddListener(NoClicked);
        }