コード例 #1
0
 public static bool ClickedOnColony(ColonyModel c1, ColonyModel c2)
 {
     // CHECK IF GIVEN LOCATION IS NOT THE SAME AS LOCATION OF COLONY
     bool clicked = false;
     if (c1.Center.X >= c2.Center.X - c2.Radius && c1.Center.X <= c2.Center.X + c2.Radius)
     {
         if (c1.Center.Y >= c2.Center.Y - c2.Radius && c1.Center.Y <= c2.Center.Y + c2.Radius)
         {
             clicked = true;
         }
     }
     return clicked;
 }
コード例 #2
0
 /// <summary>
 /// Check if the given position is equal to a existing colony.
 /// </summary>
 /// <param name="x">Mouse X position.</param>
 /// <param name="y">Mouse Y position.</param>
 /// <param name="c">Current used ColonyModel</param>
 /// <returns></returns>
 public static bool ClickedOnColony(int x, int y, ColonyModel c)
 {
     // CHECK IF GIVEN LOCATION IS NOT THE SAME AS LOCATION OF COLONY
     bool clicked = false;
     if (x >= c.Center.X - c.Radius && x <= c.Center.X + c.Radius)
     {
         if (y >= c.Center.Y - c.Radius && y <= c.Center.Y + c.Radius)
         {
             clicked = true;
         }
     }
     return clicked;
 }