예제 #1
0
        // GET api/<controller>


        // GET api/<controller>/5
        public string Get()
        {
            Bitki  btk = new Bitki();
            string s   = JsonConvert.SerializeObject(btk.GetBitkiAdlari());

            return(s);
        }
예제 #2
0
    void Update()
    {
        if (Physics.Raycast(Camera.main.transform.position, Camera.main.transform.forward, out hit, mesafe))
        {
            if (hit.transform.tag == "Tree")
            {
                Bitki bi = hit.transform.gameObject.GetComponent <Bitki>();
                rayText.GetComponent <Text>().text = "Tree Health: " + bi.can.ToString();
            }
        }
        if (Input.GetMouseButtonDown(0) && !aktif)
        {
            aktif = true;
            zaman = maxzaman;
            if (Physics.Raycast(Camera.main.transform.position, Camera.main.transform.forward, out hit, mesafe))
            {
                if (hit.transform.tag == "Tree")
                {
                    Bitki bi = hit.transform.gameObject.GetComponent <Bitki>();
                    bi.can -= Random.Range(hasar1, hasar2);

                    er.items[GetComponent <ItemEl>().slotsayi].itemkullanim -= Random.Range(3, 6);
                    if (er.items[GetComponent <ItemEl>().slotsayi].itemkullanim < 0)
                    {
                        er.items[GetComponent <ItemEl>().slotsayi] = new Item();
                    }
                    Debug.Log(er.items[GetComponent <ItemEl>().slotsayi].itemkullanim + "-" + er.items[GetComponent <ItemEl>().slotsayi].itemismi);
                }
            }
        }

        if (aktif)
        {
            if (zaman > 0)
            {
                zaman -= 3 * Time.deltaTime;
            }
            else
            {
                aktif = false;
            }
        }
    }