// Update is called once per frame
 void Update()
 {
     if (first)
     {
         gui = GameObject.FindGameObjectWithTag("GUI").GetComponent<GUIclass>();
         unit = this.transform.parent.gameObject;
         unitController = unit.GetComponent<UnitController>();
         first = false;
     }
     isCommanded = gui.isCommandModeON;
     if (!isCommanded)
     {
         if (enemies.Count > 0)
         {
             if (unitController.getTarget() == null)
             {
                 unitController.setTarget(enemies.First());
             }
         }
     }
 }
 // Use this for initialization
 // find main camera and gamecontroller
 void Start()
 {
     selectionBox = new Rect (0,0,0,0);
     cam = GameObject.Find("Main Camera").GetComponent<Camera>();
     selected = new List<GameObject> ();
     gameController = GameObject.Find("GameController").GetComponent<GameController>();
     asteroid = null;
     gui = GameObject.FindGameObjectWithTag("GUI").GetComponent<GUIclass>();
 }