Beispiel #1
0
 private int DistanceTo(BuildingResources r)
 {  //checks distance between units and rescoures
     if (r.GetType() == typeof(BuildingResources))
     {
         BuildingResources n = (BuildingResources)r;
         int d = (Xpos - n.Xpos) + Math.Abs(Ypos - n.Ypos);
         return(d);
     }
     else
     {
         return(0);
     }
 }
Beispiel #2
0
 private int DistanceTo(BuildingResources b)//checks the distance to other buildings
 {
     if (b.GetType() == typeof(BuildingResources))
     {
         BuildingResources f = (BuildingResources)b;
         int d = (Xpos - f.Xpos) + Math.Abs(Ypos - f.Ypos);
         return(d);
     }
     else
     {
         return(0);
     }
 }