Exemplo n.º 1
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetMouseButtonDown(0))
     {
         r_hit = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero);
         if (r_hit)
         {
             if (r_hit.collider.gameObject.tag == "Worker")
             {
                 StartCoroutine(pick_up_worker(r_hit.collider.gameObject));
             }
             else if (r_hit.collider.gameObject.tag == "Control_Tag")
             {
                 StartCoroutine(pick_up_tag(r_hit.collider.gameObject));
             }
         }
     }
     if (Input.GetKeyDown(KeyCode.Escape))
     {
         if (ws != null)
         {
             ws.close_stats();
             ws = null;
             track_mouse();
         }
     }
 }
Exemplo n.º 2
0
    IEnumerator pick_up_worker(GameObject worker)
    {
        //set_manager(r_hit.collider.gameObject);
        //if (cur_manager != null)
        //    deselect_manager();
        ws = r_hit.collider.GetComponent <Worker_Stats>();
        ws.show_stats();
        //track_player(cur_manager);
        //track_player(r_hit.collider.gameObject);
        IEnumerator enumer = attach_to_mouse(worker);

        StartCoroutine(enumer);
        yield return(new WaitUntil(() => !Input.GetMouseButton(0)));

        StopCoroutine(enumer);
        ws.close_stats();

        get_new_assignment(worker);
    }