Exemplo n.º 1
0
 public void unitClicked()
 {
     if (units.Clicked != currentClicked)
     {
         currentClicked = units.Clicked;
         foreach (GameObject a in adj)
         {
             a.GetComponent <SpriteRenderer>().GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 255);
             a.GetComponent <TerrainScript>().unit = null;
             a.GetComponent <TerrainScript>().GetComponent <TerrainScript>().check = false;
         }
     }
     if (units.Clicked != null)
     {
         Vector2 cord = map.convertWorldToMapCord(units.Clicked.transform.position);
         adj = map.getAdjacent(cord);
         foreach (GameObject a in adj)
         {
             a.GetComponent <SpriteRenderer>().color = new Color(255, 0, 0, 255);
             a.GetComponent <TerrainScript>().unit   = units.Clicked;
             a.GetComponent <TerrainScript>().check  = true;
         }
     }
 }