Exemplo n.º 1
0
 void Update()
 {
     timer--;
     clock.text = "you have " + timer + " seconds";
     if (timer == 0)
     {
         Time.timeScale  = 0;
         timer           = time;
         manager.workedF = true;
         Application.LoadLevel(1);
     }
     if (Input.GetMouseButtonDown(0))
     {
         ray = Camera.main.ScreenPointToRay(Input.mousePosition);
         Physics.Raycast(ray, out hitinfo, Mathf.Infinity);
         GameObject target = hitinfo.collider.gameObject;
         if (target == null)
         {
             Debug.Log("");
         }
         if (target.tag == "Enemy")
         {
             Debug.Log("whack!");
             health h = target.GetComponent <health>();
             if (!h)
             {
                 Debug.Log("");
             }
             h.Dodamage();
         }
     }
 }